根据空格换行

public string specialprint(string str)
{
string result = "";
char c = (char)10;
string[] arr_terms;
if (str != null)
{
arr_terms = str.Split(c);
for (int i = 0; i < arr_terms.Length; i++)
{
string formatedstr = arr_terms[i].Trim();
string numlist = "(" + (i + 1).ToString() + ")";
if (formatedstr.StartsWith(numlist))
{
result = result + "<tr><td width='15px' style='vertical-align:top;'>" + numlist + "</td>"
+ "<td style='font-size:11px'>" + formatedstr.Replace(numlist, "") + "</td></tr>";
}
else
{
result = result + "<tr><td>&nbsp;</td><td style='font-size:11px'>" + formatedstr + "</td></tr>";
}
}

return result;
}
return result;
}

原文地址:https://www.cnblogs.com/suan1717/p/6386682.html