根据字符串截取想要的位置加标识或者换行,指定规则每多少个字后添加换行
public string TransWantText(string sequence, int howMany = 100, int howLine = 5, string lineCode = "<br />")
{
//5行
//ToUpper()
string resultStr = string.Empty;
//转换为大写
string sourceStr = sequence.ToUpper();
int length = sourceStr.Length;
int maxLine = length / howMany > howLine ? howLine : Convert.ToInt32(length / howMany);
//循环N次
for (int i = 0; i < maxLine; i++)
{
resultStr += sourceStr.Substring(howMany * i, howMany) + lineCode;
}
return resultStr;
}