String manipulation for name and direction

good afternoon

I want to extract each data from a variable with the value of

Jose Manuel Perez Dominguez

my goal is to extract each value

name = jose
middle name = manuel
paternal last name = perez
mother’s last name = dominguez

I also want to extract each value from an example address variable


want to get the value of “bambamarca”

HI @borismh

You can try splitting the string using the space…

SplitArray = StringVariableName.Split(" "c)

This will give you a string array with all individual values. Next what you can do is. Get the values assigned to the variables based on the position identifier of the array…

Name = SplitArray(0).ToString
MiddleName = SplitArray(1).ToString

And once it comes to this value “CAJAMARCA-HUALGAYOC-BAMBAMARCA”, split again using the “-” character and get the last index value which will return the expected part you need.

make sense?

1 Like


and if a name like that appears

Boris Munguia Huaman

with only 3 values without middle name

I want to become dynamic, because they are values extracted from the web


So, is there a way we can identify whether the name in the middle is actually the middle name or the parental last name?

In our country, we usually add the names that come in middle under middle name… is it the same in your country or is it different?

1 Like


if the data appears with 3 words

Boris Munguia Huaman
so the middle one is the last name

but if the data appears with 4 words

Boris donald munguia huaman
then the middle one is the middle name

there is a way to determine if there are 3 or 4 words to put it into an if condition

1 Like

Yes… You can determine the length of the name by using the count of elements in the array…

So once you split by the space, you get an array right. On that variable you can use the below code to get the count


Based on the count, you can use an IF condition activity to check whether the names in the middle are actually middle names of the parental name :slight_smile:

1 Like


perfect already solve the first part

now in reference to the other address data
There is a way to get the latest data, since this is much more variable than the name and surname data

1 Like

Yes… you can do that… So for the address, we need the last element

So, split is first by “-” character

ArrayName = StringVariable.Split("-"c)

Now, use a assign activity and get the count of the array to identify the length of it.

Int Length = ArrayName.Count()

Now, we know the length… length means, the last element of the array :slight_smile:

So to get the last element of the array.

ArrayName(Length - 1).ToString will give you the last element

1 Like

You have to specify the name of the array variable here

1 Like

If i noticed
why delete the message xde

1 Like

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