I have looked around online for help with this, but I can't seem to find anything. So it makes me think I'm either missing something or not looking for it the right place, that's why I'm bringing it here.
I would like to compare strings in ObjC and ignore the case of the letters in each string. I have comparing the strings down, but I can't figure out how to compare them while ignoring case.
For example, getting "Hello" = "hello"
or "hello" = "Hello"
One string comes from user input via textfield. I have that set-up like this:
NSString *fieldOfText = fieldText.text;
The other string comes from the "if" statement. I have that set-up like this:
if ( [fieldOfText isEqualToString
"hello"])
{
doSomething
}
else if ( ![fieldOfText isEqualToString
"hello"])
{
doSomethingLikeDisplayAlert
}
What would be the best way to ignore/compare the strings while ignoring cases?
Thanks for reading, and thanks in advance!
I would like to compare strings in ObjC and ignore the case of the letters in each string. I have comparing the strings down, but I can't figure out how to compare them while ignoring case.
For example, getting "Hello" = "hello"
or "hello" = "Hello"
One string comes from user input via textfield. I have that set-up like this:
NSString *fieldOfText = fieldText.text;
The other string comes from the "if" statement. I have that set-up like this:
if ( [fieldOfText isEqualToString
{
doSomething
}
else if ( ![fieldOfText isEqualToString
{
doSomethingLikeDisplayAlert
}
What would be the best way to ignore/compare the strings while ignoring cases?
Thanks for reading, and thanks in advance!