Split参数StringSplitOptions.RemoveEmptyEntries的使用

来源:互联网 发布:gcc编译器linux下载 编辑:程序博客网 时间:2024/05/23 02:04

  string test = "程$晓$";

  使用:string[] temp = test.Split(new string[] { "$" }, StringSplitOptions.RemoveEmptyEntries);
  输出结果:数组长度为2 temp[0]="程" temp[1]="晓";
 

  使用:string[] temp = test.Split(new string[] { "$" }, StringSplitOptions.None);或string[] temp = test.Split('$');


  输出结果:数组长度为3 temp[0]="程" temp[1]="晓" temp[2]="";
  


  参考:http://www.cnblogs.com/xiurui12345/archive/2012/05/10/2493814.html

原创粉丝点击