How should I split an address to fill different fields


How should I split an address to fill different fields. i am currently getting the full address in one field and would like to split it into a few different fields.

from one field
all as separate items


I would suggest that you use the Split Activity with a single white space as the separator. This will give you an array of strings with {“FAIRFAX,”, “VA”,“22030”} as the values. Then you call String.Remove() on the first value to get rid of the comma. See Attached
String Manip.xaml (7.3 KB)


Thanks, that’s very helpful. I do have a followup question. In the case of the city having a space in between(ex. New York) it is cutting out the w in New and leaving the comma after York. Do you know what would cause this?




That is because the array would now have an extra value.
FAIRFAX, VA 22030 would lead to {“FAIRFAX,”, “VA”,“22030”}
New York, NY, 10065 would lead to {“New”, “York,”, “NY”, “10065”}
You would have to configure the workflow to accept the last word of a multi-word named city on which to perform the remove method. I would do this by using the index (arr.count - 3)


You could do this by storing each value individually and using the comma:

city = address.Trim.Split(","c)(0)
state = address.Trim.Split(","c)(1).Split(" "c)(0)
zip = address.Trim.Split(","c)(1).Split(" "c)(1)

You can also use a Regex pattern but I will just present the .Split method.

There could be other ways to.



Hi @DavidV32,
Here I have attached the sample to split the City , state and zip. It has excel that you can able to test to add more data.

File : Split an (7.9 KB)



Parsing is an age old skill, not RPA specific.

The trick is to start with what you know and back into what you don’t.
So the first thing you have to know is what your input patterns will be.

If you are always receiving <city>, <two char state> <zip>, then you can use split with whitespace, pull the last item as the zip, the next to last item as state code and then concatenate all the previous ones and drop the comma (if exists). That way you can catch whatever city name you get, no matter how many spaces.

If your input format has more variability than that, you may need to think through your algorithm a little more.

Happy parsing.