Split String?

Hi. I want to know how can I Do to obtain of String:
“The selected country is Spain”
The String: “Spain”

The question is that sometimes the country has 2, 3 or 4 words like
“The selected country is United States of America” and i want to obtain “United States of America”
.

IF this part “The selected country is” is always the same you can use Matches regex activity.

-In input property put the value of your string
-In pattern property put
(?<=is ).*

-In result property create new variable with CTRL+K and name it RegexResults

After that you can get RegexResults(0).Value for your result

1 Like

Try this :

string.Substring(string.IndexOf("The selected country is ") +"The selected country is ".Length)

2 Likes

Thank you, so much!
Both cases are working.
But I decided to use Substring :wink:
Thanks!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.