String Problem

Hello, for some automation purpose I want to use this string:
Cost= “$134.51
$161.41 inc. British VAT” in the same manner, but i want to use only the first line. What expression should i use?

Hi @Apurv_Joshi

Have a look at the below thread!



We can use split method like this if your input has multiple lines with it
Say you have a input in a variable named strinput

Then use a assign activity like this

Stroutput = Split(strinput.ToString.Trim, Environment.NewLine.ToArray())(0).ToString.Trim

This will give output as “$134.51”

Cheers @Apurv_Joshi


Assign Cost = Cost.split(chr(13)).first.trim

I personally prefer using the .first / .last values on splitting into arrays, but that is purely for legibility.

1 Like

then we can also regulate the Regex output by its match / occurence count if needed