How to check if a string Contains particular strings

Hy Guys,
Does Anybody know how to check if a Text (string) contains particular Words (strings)?
For exmple I have a Text:
Dear ,
We are happy to inform you that you got in .

I have to change the Words where you can see <…> this.

My actual text is much longer and I have to replace like 100 words with other words which are saved in another string.
Thanks for your help :slight_smile:

2 Likes

yourstring.Contains(value) can help.

3 Likes

hi
welcome to UiPath community
we can use CONTAINS method from string class
like this
yourstringvariable.ToString.Contains(“your text to be found”)
which will give us boolean value as output
but
i didnt get this

Cheers @Puppedli

9 Likes

Você pode usar a função variable.Replace(“,”,“.”).

1 Like

and what if my string is a list of numbers (“1 12 35 36 37 90 92”)
and I’m getting one of this options, like i will get “3” won’t it show that its exist (in the 35, the first one that shows 3)?

First, split the string by " ".
This will result in an array: {"1", "12", "35",....}
Then, you can check if the array contains what you need:

yourString.Split(" "c).Contains("3") will return False
yourString.Split(" "c).Contains("35") will return True

4 Likes

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