Parse String

I have a sample string with some info, lets say


How can I parse everything after the colons of these main categories? I was considering to read character by character and stop at the end of the new line - which leads me to my next question. How do I determine when I am at a new line? I come from a ‘C’ background so I’m used to just checking if string = ‘\n’ then … to check but I am not sure how to check in uipath/vb.

String.split variable will create separate sub strings and will store it in a variable of array of strings.
Take an array of string variable as “aTest”. Assign it the value of string.split(":")
Then you can get the values of right hand by calling “aTest(1).ToString”,“aTest(3).ToString” & “aTest(5).ToString”.

This gives me the value until the next “:” as well though. For example:

Name: user
Gender: Male

If I do string(1) it will give me user\nAge where I just want “user”


Name: user
Gender: Male

This will be stored in one variable or different , different variables?

Store those three lines in a string variable. In my example below it is TestString.

Then you can use the Assign activity to store the value of the Name in another variable.

TestString.Substring(TestString.IndexOf("Name: ")+"Name: ".Length).Split(Environment.NewLine.ToCharArray)(0)

Replicate for age and gender.

Example attached:

TestString_Parse.xaml (6.9 KB)

1 Like