String Manipulations

Hi ,
Below is my string Text_NameAndAddress.

Text_NameAndAddress=“Date -1/12/2019 \r\nTom Hanks \r\n789 Broad Street \r\nPeoria, IL 61615 \r\n”
I want to split my data with ‘\r\n’ by using below syntax.
Text_NameAndAddress.Split({vbCr,vbLf},StringSplitOptions.None)

I am getting data in the below format but why i am getting extra “” quotes how to
string[9]
{
"Date -1/12/2019 ",
“”,
"Tom Hanks ",
“”,
"789 Broad Street ",
“”,
"Peoria,
IL 61615 ",
“”,
“”
}

I want split at a time with ‘\r\n’.

This is due to using vbCr and vbLf seperately, it is using both characters to split the text on. Instead split using a \r\n or use vbCrLf to split only once per instance.

Text_NameAndAddress.Split({vbCrLf}, StringSplitOptions.None)
string[5] 
{
  "Date -1/12/2019 ",
  "Tom Hanks ",
  "789 Broad Street ",
  "Peoria,
  IL 61615 ",
  "" 
}
1 Like

Thank you twhitehead.

Issue got resolved.

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