Split string multi lines

Hi guys

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

DOMAINE = 1
SOC= 1
OBJ = Demande
PRI = 2

Can you help me please?

Hi
Welcome to uipath community
If this string is In variable named str_input
Then
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
Split(item.ToString,”=“)(1).ToString.Trim

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

Cheers @sebast56100

Hi,

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

Regards,

1 Like