String manipulation - How can we split?

Hi guys!
Someone know how split a string using environment.newline?

Miller, Dusty
1251 Technology Pkwy ste 400
Ceder Falls, IA 56130-4121"

The purpose is just to split text
name
address
cityStateZip
city
stateZip
state
zip
country

Ty,

@VishnuPrakash

inputString=John Doe
123 Main St
555-1234

splitArray = inputString.Split({Environment.NewLine}, StringSplitOptions.None)

Use For each to loop over the array.Or use Index like splitArray(0)it gives the first line in the text.

1 Like

Hi @VishnuPrakash

Use the Regular expression for it,

- Assign -> Input = "Miller, Dusty
                     1251 Technology Pkwy ste 400
                     Ceder Falls, IA 56130-4121"

- Assign -> List_Matches = System.Text.RegularExpressions.Regex.Matches(Input.ToString(), "[A-Za-z0-9]+.*").Cast(Of System.Text.RegularExpressions.Match)().Select(Function(X) X.Value).ToList()

It will also split the every line.

Or you can use the below String Manipulations,

- Assign -> Input = "Miller, Dusty
                     1251 Technology Pkwy ste 400
                     Ceder Falls, IA 56130-4121"

- Assign -> List_SplitValues = Input.Split({Environment.Newline}, StringSplitoptions.None)

List_Matches and List_SplitValues is a List of String datatype.

Check the below workflow for better understanding,

Hope it helps!!

1 Like

Hi @rlgandu
Could you please briefly explain this?

@VishnuPrakash

As i see your data is in excel file
Please read that data using Read range workbook
Build datatable–>Name,Address,…
Use For each row in datatable activity

splitArray = row("Your Column Name").ToString.Split({Environment.NewLine}, StringSplitOptions.None)

and then use string manipulations or Regex Expressions to extract the name,address,city,state,zip and so on
And then use Add datarow activity

use Write range workbook

1 Like