How to ignore case while reading text?

How to ignore case while reading text?

I have a string in excel cell, which could be listed in upper case or lower case or mixed

How can I ignore case and check only for the text? I do not want to convert the text to upper or lower, but want to ignore the case

Hi @Krithi1

If possible could you share an sample input and required output.

Regards

I could have the following text in my excel cell

“Keerthi”, “KEERTHI”, “keerthi”, “keeRTHI” etc

I need to check if the name is so and so, case doesn’t matter.

Hi @Krithi1

Will you have any fixed string for this like Keerthi.

Regards,

yes, I need to check for a fixed string that contains “Keerthi”

Assuming…

variable stringToCheck = “some words and then the name keerthi and then some more words”
variable checkAgainst = Keerthi

Just do…

If stringToCheck.ToUpper.Contains(checkAgainst.ToUpper)

This doesn’t change the value in the variables. It just makes them both upper case for the purposes of this one expression, for this comparison.

1 Like

Hi @Krithi1

Try the below:

str1 = "Keerthi"
str2 = "keerthi"

If String.Compare(str1, str2, StringComparison.OrdinalIgnoreCase) = 0 Then
    // The strings are equal (case-insensitive)
    // Add your desired actions here
Else
    // The strings are not equal
    // Add alternative actions if needed
End If

Hope it helps

Hi @Krithi1

How about the following?
image

String.Equals("inputString", "stringToSearch", StringComparison.OrdinalIgnoreCase)

Regards

1 Like

Hi @Krithi1

Solution 1:

String.Equals(Value1,Value2, StringComparison.OrdinalIgnoreCase)


Solution 2:

Value1.ToLower.Equals(Value2.ToLower)

image

Hope it will helps you :slight_smile:
Cheers!!

@Krithi1

You can use find/replace activity where you have option to select matching case or no

Cheers

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