Split string help

Hi

I am new in ui path.
i store in variable some string , i want to store in a new variable only the number in the string.
attached photo :

TNX

Hi @maayan,

You can do this many different ways:

  • Split by new line - result = strVar.Split(Environment.NewLine.ToCharArray)(0) —> 0 is the index to pull the first value

  • Regular Expressions to extract the numbers only - result = Regex.Match(str,“\d+”).Value

Happy Automating!

Regards.
PD

1 Like

@maayan Instead of separate variable you can use in the same variable.use one assign activity as shown below

Assign urvariable = System.Text.RegularExpressions.Regex.Match(urvariable,“(\d)”).Value

Refer this regex101: build, test, and debug regex