List<string> list = new List<string>(); //定义数组
//转换成 ';'或者空字符
string wl = TextBox1.Text.Replace("\n", ";").Replace(" ", ";").Replace("\t", ";").Replace("\r", " ");
string[] a = Regex.Split(wl, ";", RegexOptions.IgnoreCase); //按照‘;’变成数组
for (int i = 0; i < a.Length; i++)
{
Response.Write( a[i].ToString()+" ");
}
List<string> strwl = new List<string>();
List<string> strprice = new List<string>();
![在这里插入图片描述](https://img-blog.csdnimg.cn/20191114172438151.png)
C#去除字符串中的空格,回车,换行符转变成‘;’在按‘;’分组成为数组
最新推荐文章于 2022-02-18 09:00:05 发布