在写代码时经常遇到字符串截取问题,下面是在C#编程中一种不错的截取方式。

string str="A,B,C,D";

string strTemp1=str.Split(new char[] { ',' })[0];

string strTemp2=str.Split(new char[] { ',' })[2];

 

则结果为

strTemp1 为 A

strTemp2 为 C

相关文章:

  • 2021-07-26
  • 2021-10-22
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-29
  • 2021-07-03
  • 2022-12-23
  • 2022-12-23
  • 2021-06-29
相关资源
相似解决方案