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
Parvathy
(PS Parvathy)
January 4, 2024, 4:18pm
2
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.
Parvathy
(PS Parvathy)
January 4, 2024, 4:30pm
4
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”
postwick
(Paul Ostwick)
January 4, 2024, 5:32pm
6
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
Parvathy
(PS Parvathy)
January 4, 2024, 5:36pm
7
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?
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)
Hope it will helps you
Cheers!!
Anil_G
(Anil Gorthi)
January 5, 2024, 7:56am
11
@Krithi1
You can use find/replace activity where you have option to select matching case or no
The UiPath Documentation Portal - the home of all our valuable information. Find here everything you need to guide you in your automation journey in the UiPath ecosystem, from complex installation guides to quick tutorials, to practical business...
Cheers
system
(system)
Closed
January 9, 2024, 5:26pm
12
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.