Contains doesn't function well

Hey all,

i encounter a problem in my automated process.
I am reading the Subject of an email and if this subject contains one of the words that i have in my String array, the bot will continue to the next email.

The Problem that occurs is, that in most cases it works well but some mails contain a word that is in my String array and it still get edited by the bot.

→ this is the code i use to look if the words are in the subject

CurrentMail.Subject.ToString.ToLower.Contains(item.ToString.ToLower) = Nothing

Thank for your help.

Best regards.

1 Like

Contains() return a boolean (True or False value). You shouldn’t compare it with null (Nothing). Have your tried to compare it with True or False instead?

1 Like

i wiil try this thank you buddy

grafik

Last line showing on a more solid approach handling it case insensitive

Hi

You are almost done

Just use this part of your existing condition
CurrentMail.Subject.ToString.ToLower.Contains(item.ToString.ToLower)

This will check directly whether the string you have is in mail subject or not

Nothing or Null is something different which can be used when you feel there is no subject at all in your mails
Something like this

String.IsNullOrEmpty(CurrentMail.Subject.ToString.)

Cheers @Camlice_Tolga

2 Likes

Hi @Camlice_Tolga

Any further queries on this topic

Hi Palaniyappan,

at the moment im Testing the advices i received. After that i will mark the solution :slight_smile:

1 Like

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