C#关于字符串换行问题

来源:百度知道 编辑:UC知道 时间:2024/04/29 12:55:34
我从服务器调用一个数据是一个很长的字符串,怎样在特定字符换行(特定字符后换行),或者指定若干字符后换行?

string content="dsdsdsdsdssdsdsdsdsdsds";
string findStr = "特殊字符";
//用于网页
string newContet = content.Replace(findStr,findStr+"<br />");
//用于winform
string newContet = content.Replace(findStr,findStr+"\r\n");

string strOriginal = "Your long string";
strOriginal.Insert(int postion, "\r\n");

postion若干字符的位置.

是web页面的话
string strOriginal = "Your long string";
strOriginal.Insert(int postion, "<br />");