Contains string

i am taking description of 3 -4 lines in the text field using get full text then I want check whether the text contains “Excel” or “Json” how to do this ?

2 Likes

Hey @sowmya

you can use like this

txt is your get text activity output lets assume.

String var = txt.toString()

Bool result = var.contains("Excel") or var.contains("Json");

it will return true if that string contains words above.

Regards…!!
Aksh

3 Likes

description is output of my get full text activity

String descriptionVal = description.toString() in assign activity

Bool boolVar =descriptionVal .contains(“Excel”) OR descriptionVal .contains(“Json”); given in searchValue property of contains string activity
getting error :options strict on disallows implicit converstion from Boolean to string.

if it contains Excel/Json I want that text exist in the text field. I mean I want to know whether excel or json how can I do

Check this workflow for your basic understanding Sample.xaml (8.8 KB)

where you are using it to print or something you can convert it like your_bool_var.ToString() or in Condition Statements you can directly pass that Boolean output.

Regards…!!
Aksh

2 Likes

Hi,
If you want all matches from the text, then you can try with “Matches” activity by providing regex pattern with both matching words (“Excel|Json”). The activity will return enumerable object with all matching words.
You can check the example here → matches.xaml (6.2 KB)

Hope this helps,
Rafal

7 Likes

Thank you rafal

Thank you akshay

hey akshay, I have a doubt, Lets say I am looking for a set of keywords in a text file. I have stored the keywords in as a regex expression
var= System.Text.RegularExpressions.Regex.IsMatch(txt5,“(Camel|Rhino|Ant|Hippo)”)

I need to check whether these keywords are there. Assume the read text output be txt
if txt.contains(“+var+”)
but I am not able to make it work…How to do it??