Split string multi lines

Hi guys

I need to get all strings after “=” for each line

SOC= 1
OBJ = Demande
PRI = 2

Can you help me please?

Welcome to uipath community
If this string is In variable named str_input
arr_lines = str_input.ToString.Split(Environment.NewLine.ToArray())

Where arr_lines is a variable of type array of string

—now use a FOR EACH activity and mention the above variable as input and change the type argument as string
—inside the loop use a WRITELINE activity like this

This will display all the values next to =
If we want we can store that to a string variable

Cheers @sebast56100


If line break of your data is CrLf, perhaps you should use StringSplitOptions.RemoveEmptyEntries option for split method to remove empty item, as the following.

arrStr = strData.Split(Environment.NewLine.ToCharArray(),StringSplitOptions.RemoveEmptyEntries)

Then you can split each item of the array in For Each activity.
strValue = item.toString.split("="c)(1)

It might be a good idea to use Dictionary for accessing easily as follows:

arrKeyValue = item,toString.split("="c)
dic(arrKeyValue(0).trim) = arrKeyValue(1).trim


1 Like