0

How can I split a string that may contain substrings that carry on to multiple lines into an array of strings by lines?

For example,

"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",

Current code:

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

Returns:

""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","

What I would like to be returned:

""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","
Bhav
  • 1,957
  • 7
  • 33
  • 66

0 Answers0