拆分包含多行子串的子串到子串中

时间:2017-12-11 10:31:04

标签: c# string split substring

如何将包含多行的子串的字符串拆分成一行字符串数组?

例如,

"1234","01",111,AreaA,10/10/2017 11:13:10,
    1,10/09/2017 18:45:00,23296151,"JOHN","- 11/09/2017 18:45:19  U JOHN 0036
  CONFIRMED",
    2,11/09/2017 14:25:00,23296151,"BECCA","- 11/09/2017 15:45:19  U BECCA 0036
  CONFIRMED",

当前代码:

        string[] stringSeparators = { "\r\n" };
        string[] lines = auditMessage.Split(stringSeparators, StringSplitOptions.None);

返回:

""1234","01",111,AreaA,10/10/2017 11:13:10,"
"       1,10/09/2017 18:45:00,23296151,"JOHN","- 11/09/2017 18:45:19  U JOHN 0036"
"      CONFIRMED","
"       2,11/09/2017 14:25:00,23296151,"BECCA","- 11/09/2017 15:45:19  U BECCA 0036"
"      CONFIRMED","

我想要归还的内容:

""1234","01",111,AreaA,10/10/2017 11:13:10,"
"       1,10/09/2017 18:45:00,23296151,"JOHN","- 11/09/2017 18:45:19  U JOHN 0036 CONFIRMED","
"       2,11/09/2017 14:25:00,23296151,"BECCA","- 11/09/2017 15:45:19  U BECCA 0036 CONFIRMED","

0 个答案:

没有答案