字符串格式为:
fhaklahfhasd
jfalkdsfl,kasjd
要把该字符串分解为3段:第一段为第一行,第二段为第二行的逗号前面的那部分,第三段为逗号后面的部分。请各位高手赐教

解决方案 »

  1.   

    用split直接就拆分开了        string delimStr = " ,.:";
        char [] delimiter = delimStr.ToCharArray();
            string words = "one two,three:four.";
            string [] split = null;
    split = words.split(delimiter);
      

  2.   

    就是有一段文字11111
    222,33333以上是一个整体,把这个整体分为3部分,第一部分:11111,第二部分:222,第三部分:33333这样。我自己写了一段代码,请指教Regex r=new Regex(@"(\s)\\r\\n(\s)(,)(\s)");
    string[] temp;
    temp=r.Split(oneresult);
    filename = temp[0];
    fileurl = temp[1];
    filesize = temp[2];结果却分不开,不知哪里写错了
      

  3.   

    "
    用split直接就拆分开了        string delimStr = " ,.:";
        char [] delimiter = delimStr.ToCharArray();
            string words = "one two,three:four.";
            string [] split = null;
    split = words.split(delimiter);
    "
    学习...
      

  4.   

    string[] array = str.Replace("\r\n", ",").Trim ().Split(new char[] { ',' });
      

  5.   

    如果可能有多个换行,可以用正则..str="你的字符串";
    Regex rx = new Regex(@"(\r\n)+");
    string[] array = rx.Replace(str, ",").Trim ().Split(new char[] { ',' });
      

  6.   

    收到后来用“,”替换\r\n,再用“,”split,就ok了