编程语言
首页 > 编程语言> > C# 字符串分割

C# 字符串分割

作者:互联网

用字符串分割

1 using System.Text.RegularExpressions;
2 string str="aaajsbbbjsccc";
3 string[] sArray=Regex.Split(str,"js",RegexOptions.IgnoreCase); //分割结果为aaa bbb ccc

 用多个字符串分割

1 string str="aaajbbbscccjdddseee";
2 string[] sArray=str.Split(new char[2]{'j','s'}); //分割结果为aaa bbb ccc ddd eee

 用单字符分割

1 string str="aaajbbbjccc";
2 string[] sArray=str.Split('j'); //分割结果为 aaa bbb ccc

 参考网址

  [1] https://blog.csdn.net/qq_29577295/article/details/90202037

标签:sArray,分割,string,C#,bbb,Split,str,字符串
来源: https://www.cnblogs.com/luyj00436/p/11658687.html