1.字符串以","(注意中英文)拼接 2.去掉最后","3.再使用split分隔放在数组中,4在循环遍历数组使用

 方法一:str=str.Remove(str.Length - 1); 或者str=str.Substring(0.str.Length - 1)
         string [] arrystr=str.Split(',')
          for(int i=0;i<arrystr.Length;i++)

         { 相应操作 }

 方法二:string [] arrystr=str.Split(',')
              for(int i=0;i<arrystr.Length;i++)

         {  if(arrystr[i]!=""){相应操作}  }

   总结: 比较两者,如果调用他人的方法,截取方式可能不准确,此时使用后者较合适,从效率上讲,后者占优

相关文章:

  • 2021-11-25
  • 2022-12-23
  • 2021-09-19
  • 2022-12-23
  • 2021-09-05
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-24
  • 2021-11-22
  • 2022-12-23
  • 2022-12-23
  • 2021-09-07
相关资源
相似解决方案