How to split a string with "\r\n"

I have this string and i need to get a Array separated with \r\n
input: “A,B,C,D,E,F,G\r\n2H,3G,H5,I.3,XBOX,$0.00,table\r\n”
Output: {“Date,Number,PNumber,Total,Name,Numer,Line”,2023,68,35,7.32,XBOX,$0.00,table}
I tried with:
str.Split(Environment.NewLine.ToArray,StringSplitOptions.RemoveEmptyEntries)
str.Split(CChar(vblf))
but give an Array with only one item with the same string.

@Fabio_Villamil ,

Use Split method like this in Assign activity.

resultArray = str.Split({"\r\n"}, StringSplitOptions.None)

Code Snippet:

Thanks,
Ashok :slight_smile:

1 Like

Hi,

Can you try either of the following?

yourStrnig.Split("\r\n")

OR

System.Text.RegularExpressions.Regex.Split(yourStrnig,"\\r\\n")

Regards,

Hi,

You can use regex here,

System.Text.RegularExpressions.Regex.Split(inputStrnig,“\r\n”)

Thanks

Thank you so much
This one was the solution
str.Split({“\r\n”}, StringSplitOptions.None)

1 Like

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