How to split string for multiple lines?

New Text Document.txt (486 Bytes)

Hello,

You can use Environment.NewLine as a separator in the split:

Text.Split(Environment.NewLine.ToArray, StringSplitOptions.RemoveEmptyEntries)

Regards

only required below points in separate variable

  1. 06-May-2019
  2. 8675309
  3. James
  4. Printing and Copying
    5)Due on Receipt
    6)06-Jun-2019
  5. 100
    8)Clear front covers
    9)$0.49
    10)$49.00

unable to get exact string

Hi @Priyanka_Jadhav1 ,

Read the text file, and use the syntax: yourString.Split(Environment.NewLine.TocharArray)
and loop through for each.

Thanks,
Ashwin

Try using regular expression:

e.g:

  1. Due on receipt Date = System.Text.RegularExpressions.Regex.Match(strText,"(?<=Due on Receipt ).*").value
  2. For invoice no: System.Text.RegularExpressions.Regex.Match(strText,"\d{7}").value

how to find out this expression, please tell me.

You can build and test regular expressions using:

[quote=“suraj3501, post:6, topic:357988”]
Thank you

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.