123456,147852,655142,459665,... ...如何分别取出其中的值,并循环处理?
循环开始
   取出值
   
   其它处理代码循环结束

解决方案 »

  1.   

    string str = "123456,147852,655142,459665";
    string temp = "";
    for(int i = 0;i<str.Length;i++)
    {
         temp = str.Substring(i,1);
         if(temp != ",")
         { 
               其它处理代码
         }
    }
      

  2.   

    string sagr= "123456,147852,655142,459665";
    string[] stemp;
    stemp = sagr.Split( new char[] {','});
    for(int i=0;i<stemp.Length;i++)
    {
       //dosmothig here
    }
      

  3.   

    private void TestString()
    {
         string strTemp = "123456,147852,655142,459665";
         string[] strResults = strTemp.Split(',');
         foreach(string strResult in strResults)
         {
    //字符串处理
             MessageBox.Show(strResult);
         }
    }