STRING SPLITING AND FLOAT VALUE GET

I have a string, VARIABLE= “Amount EUR 5.00”

I need only EUR value Seperate and i need 5.00 value Seperate ,

After i am getting 5.00 value i have to convert float integer value like 500 any one know the - SPLIT MEDHOD Help me please

@BHUVAN

Try this

EURValue = str.Split({" "},StringSplitOptions.RemoveEmptyEntries)(1)

Integer = Cint(str.Split({" "},StringSplitOptions.RemoveEmptyEntries)(2).Replace(".",""))

you wanted to convert 5.00 to 500 I believe if thats correct

cheers

1 Like

HI @BHUVAN

Checkout this expression

For getting EUR

System.Text.RegularExpression.Regex.Match(VARIABLE,"(?<=Amount\s)\S+").ToString

image

For getting Value

System.Text.RegularExpression.Regex.Match(VARIABLE,"\d.+$").ToString

image

To convert it to integer

Cint(System.Text.RegularExpression.Regex.Match(VARIABLE,"\d.+$").ToString)

Regards
Sudharsan

1 Like

Thank you so much @Sudharsan_Ka :heart:

hi @BHUVAN

You can do it like this:

VariableWithCurrency = Split(VariableName, "Amount ")(1).ToString

Then now you can separate the Currency and the Value, by doing the following:

Currency = Split(VariableWithCurrency, " ")(0).ToString

Value = CInt(Split(VariableWithCurrency, " “)(1).ToString.Replace(”.“,”"))

Hope this helps.

EDIT: If you need only 5, not 500, then remove the '.Replace(“.”,“”)

Kind regards,
Kenneth

Happy automation!

1 Like