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

studio

#1

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?


#2

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


#3

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:


#4

Thank you very much! worked fine


#5

Thank you Arivu,

Well noted for the future reference.