Getting only the text from a String

Hi,

I have a variable which has the value (India-2019),

i need to find the position of sepaeator(-) and need to display only the text part(ie: India) not the number.

how can we do it in uipath.

Please help

1 Like

Fine
if the input is str_input = “India-2019”
then
for this

str_position1 = Str_input.Indexof("-").ToString

and for this

Str_output = Split(Str_input,"-")(0).tostring

hope this would help you
Cheers @Sajin_91

2 Likes

Regex.Match(inputString, "[A-Z,a-z]+”).Value

Hi Thanks for the reply,

The second step -

Str_output = Split(Str_input,"-")(0).tostring

can u please explain…its not getting

1 Like

Str_output = Split(Str_input,"-")(0).tostring
Here the input str_input has value India-2019
And split method will split the string with - as delimiter and gives us the output in array format
—So after splitting we will be having two string values {“India”,”2019”}
So to get the first value we mention as (0) atlast
Thus we get “India”

Hope this would help you
Cheers @Sajin_91

1 Like

yes .i got the result

thank you for your quick response
thanks a lot

1 Like

Fantastic
Cheers @Sajin_91