How to make the string case insensitive in .Contains()

Hello all,
I am trying to add activities to the emails that contain the word “invoice” in the subject only.
In the condition box, I have added:
mail.Subject.Contains(“invoice”)

However it doesnt take up any email with subjects that contain “Invoice” or “INVOICE”.
Is there any way for me to make the String value in .Contains case insensitive?

5 Likes

try this mail.Subject.ToLower.Contains(“invoice”)

4 Likes

Hi @bradley.kim,
Two ways can check using if condition
1.mail.Subject.ToLower.Contains("invoice")
2.mail.Subject.ToUpper.Contains("INVOICE")

You can use any one.

If suppose “invoice” string also coming in dynamically use below
1.mail.Subject.ToLower.Contains(strVariable.Trim.ToLower)
2.mail.Subject.ToUpper.Contains(strVariable.Trim.ToUpper)

Regards,
Arivu :slight_smile:

6 Likes

Thank you very much! worked fine

Thank you Arivu,

Well noted for the future reference.