參考下面代碼            string[] result;
            result=str.Split(new string[] { "\r\n+CMGL" }, StringSplitOptions.RemoveEmptyEntries);

解决方案 »

  1.   


    顶LS,少了一个转义
    string[] result;
    result=str.Split(new string[] { @"\r\n+CMGL" }, StringSplitOptions.RemoveEmptyEntries);
      

  2.   

    顶3楼
    string[] result;
    result=str.Split(new string[] { "\\r\\n+CMGL" }, StringSplitOptions.RemoveEmptyEntries);
      

  3.   

    我汗,楼上两位回帖前都不做测试的吗?string test = "1,\"REC   READ\",\"8613902480982\",,\"07/11/08,15:23:31+32\",145,3\r\n111\r\n+CMGL:   2,\"REC   READ\",\"8613902480982\",,\"07/11/08,15:23:37+32\",145,3\r\n222\r\n+CMGL:   3,\"REC   READ\",\"8613902480982\",,\"07/11/08,15:23:44+32\",145,3\r\n333\r\n ";
    string[] result = test.Split(new string[] { "\r\n+CMGL:" }, StringSplitOptions.RemoveEmptyEntries);
    foreach (string s in result)
    {
        richTextBox1.Text += s + "\n\n";
    }