-2

I want to compare 2 strings. I am doing it like this:

[someString isEqualToString:otherString];

But I have the problem that when there are capital letters but the words are the same I don't get a YES as result.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Andres Gil
  • 13
  • 1
  • 5
  • For future reference if you are trying to do something with NSString and don't know how to do it - go and look at the [NSString reference](http://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html) and see if what you want to do is listed under the section called tasks. In this case the method you want is shown under the section "Identifying and Comparing Strings". – Abizern Jul 23 '13 at 12:01

2 Answers2

3
if( [@"Some String" caseInsensitiveCompare:@"some string"] == NSOrderedSame ) {
  // strings are equal except for possibly case
}
Armaan Stranger
  • 3,140
  • 1
  • 14
  • 24
0
if([[someString uppercaseString] isEqualToString[otherString uppercaseString]])

Use condition as above

KAREEM MAHAMMED
  • 1,675
  • 14
  • 38