How to Split a string and get first word in UI path studio

Hello Everyone,

I am new to Ui path and learning from scratch.
I am trying to split a string Ex: Test_Str=“1.99 Lakh crore GDP”
Here the 1.99 value is dynamic so it will change based on user input , but I need to split and capture that number only. For ex: 1.99 .

Can anyone please suggest how to achieve that in UI path Studio community version.

str.Split (" "c)(0) → Store this in a string variable.

Another efficient way would be to use a regex to extract number from your string

Hi @Debayan_Deb ,

Assuming the format will always be the same, you could check with the Following Expression :

Split("1.99 Lakh crore GDP").First
1 Like

Regex for the same: \d+

Thanks for the update. Now it’s working…

1 Like

Hi @Debayan_Deb

Use the split operation for split all the strings by using Space(" “).
Ex - Test_str.Split(” ").First

Then it will extract first string whether it’s dynamic

Hope it helps!!

1 Like