public static string striptEnter(string str)
{
int length = str.Length;
ArrayList arr1 = new ArrayList();
for (int i = 0; i < length - 1;i++ )
{
if (str[i].ToString() == "/r")
{
arr1.Add(i);
}
}
//判断每个换车之间的内容
int lenarr = arr1.Count;
int leftpos = 0;
int rightpos = 0;
string substr = "";
string Noenter = "";
if (lenarr > 0)
{
for (int j = 0; j < lenarr; j++)
{
rightpos = Convert.ToInt32(arr1[j].ToString());
substr = str.Substring(leftpos, rightpos - leftpos);
if (CharCom.ChineseLetterCount(substr) > 5)
{
Noenter = Noenter + substr;
}
leftpos = rightpos;
}
substr = str.Substring(rightpos, length - rightpos);
if (CharCom.ChineseLetterCount(substr) > 5)
{
Noenter = Noenter + substr;
}
}
else
{
Noenter = str;
}
//Console.WriteLine(Noenter);
return Noenter;
}
c# 去除字符串中多余的换行
最新推荐文章于 2022-03-04 11:43:07 发布