有一个字符串是以逗号分隔的,我想将每个其按逗号分隔符分开显示出来

解决方案 »

  1.   

    用string的split方法区分
    string str="xxx,xxx,xxx";
    char[] spliter=new char[1];
    spliter[0]=',';
    string[] tokens=str.split(spliter);
    数组tokens里面就是你想要的结果了
      

  2.   

    string sqlStr ="1,2,3"
    string[] scores = sqlStr.Split(',');
    string a = scores[0]
    string b = scores[1]
    string c = scores[2]
    ........
      

  3.   

    string s ="1,2,3";
    string[] arr_s = s.Split(new char[] {','});
      

  4.   

    textBox.Text = str.Replace(",", "\r\n");
      

  5.   

    str="1,2,3";
    string []arr;
    arr=str.split(",".ToCharArray);
      

  6.   

    string str = "1,2,3,4,5,6";
    string[] ary = Null;
    ary = str.split(",");
    int i = 0;
    for i;i < ary.length - 1;i ++
    textbox.append(ary[i] + "\n");textbox要设mulitline
      

  7.   

    string str = "1,2,3,4,5,6";
    string[] ary =str.split(",");
    for(int i=0;i<ary.Lenth;i++)
      textBox1.Text+=ary[i]+"\r\n";
    如果需要滚动条和多行显示,需要设置mulitline属性,就像
     victorytxd(victorytxd) 兄弟说的一样