Split参数StringSplitOptions.RemoveEmptyEntries的使用

  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/chengxiaohui/articles/1815104.html

原文地址:https://www.cnblogs.com/xiurui12345/p/2493814.html