Case sensitive string

Dear Forum Members,

I have designed a BOT, which takes the string as input, in what we input some words,then the BOT search those words in a list of files. But the BOT searches for the exact match, eg. If we enter process then it will not select Process or PROCESS. Is there any way to achieve this. As change the string to uppercase or lowercase is not beneficial because don’t know, the words present in the files are in uppercase or lowercase because the files are not fixed.

Any help will be appreciated, Thanks in advance.

We have to know what kind of search you are doing so we can proper advise…

You could add regEx to your condition and check for both small and Big letters.

So split your in_string by single chars and expand string as regEx search pattern.


You could add the ignore case option. E.g. if you’re using IndexOf to search:

fileText.IndexOf("process", StringComparison.InvariantCultureIgnoreCase)

Thanks all for your response!!
My workflow is like, it will first ask the user to select the method through which he wants to input keywords, that can be Excel File, Text File or Manual input through input dialog box by giving space between each keyword. And for Text File and Manual Input, I have used Split String Method to take the words in a list format and search for keywords one by one.

Then it will ask the user to select the folder from which the BOT will pick the files and one by one pick files and search the keywords and if all the keywords are found then it will move the file to specified folder.

For this, I have used one condition as: FileText.Contains(DT.Rows(Count1)(1).ToString) to pick the column from excel in which, all the keywords are present but with this, it is searching for the exact word. I want to take it as Case Insensitive.

How can I achieve this, Thanks

You can provide the same option to String.Contains()

FileText.Contains(DT.Rows(Count1)(1).ToString, StringComparison.InvariantCultureIgnoreCase)


Thanks for your response.

I tried this code but getting this error

I’m away from my computer so I can’t test. I will get back you later. According to the documentation, Contains() should be able to accept that option.

Yeah sure, No worries.

Sorry, my bad. The overloaded function Contains(String, StringComparison) is only supported in .NET 5.0 not .NET Framework.


So your other option is to convert the text to upper (or lower) before Contains().

Outside the loop:

FileTextUpper = FileText.ToUpper

In the loop:


Converting the text to upper or lower will not be beneficial in my case. As I don’t know the words present in files will be in uppercase or lowercase. If a file has a word process, other file has word PROCESS or another file has word proCESS, The BOT should pick all the words.
I want to achieve this, Thanks

Hi, Thanks for your response.

Is there any other option. Because I need to use an IF condition like FileText.Contains(DT.Rows(Count1)(1).ToString), I am performing something in “then” part of IF.

The bot will pick all words if you use to ToUpper. Please give it a try.

E.g. the text file contains “proCESS”
User enter “process”

After ToUpper:
FileTextUpper will be “PROCESS”
User entered text will be “PROCESS”
Contains() will return true.

The BOT will convert the text to ToUpper but PROCESS and proCESS are not same, so it will not pick the file. There is one more condition, BOT will convert all the text to TOUPPER and suppose, user enters process, BOT has changed it to PROCESS and if the file contains process, then it will not pick the file.

can’t change all the words to UPPER case, if in the file we need lowercase. Correct me if i am wrong.

I’ve already explained to you that the bot will convert both the file text and the user input to upper case and then compare them. So it will work.


when you are trying to pick the files then both the side change the case and check.

I tried this option but nothing changes, it is working the way, it was working earlier. Only searching for the exactly matches text.

Could you share you workflow so we can take a look?

Please have a look

You should convert the user input to upper case also.


It should be: