Check string using contain

HI Developer Friends,.

i have some issue to check my string using contain,
actually i want to check my variable string with value “PT Dover Trading Indonesia” have a keyword “DONE” or not. this condition should be go to false, but as you can see on my screenshot this condition going to true

Hi,

Because you use ToUpper method and it returns true as Indonesia.

I think it’s better to use regex as the following.

System.Text.RegularExpressions.Regex.IsMatch(varString,"\bDone\b",System.Text.RegularExpressions.RegexOptions.IgnoreCase)

This returns true if “done” (Case ignored) exists as a word.

Regards,

2 Likes

wow, i dont realize about this keyword Indonesia , haha
thanks for your help and solution Yoichi

1 Like

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