I want to compare two strings. It fails when the string have capital letter. How do I convert both string to capitalize and compare.
I have a sample code, can someone correct this.
if ([[txtAnswer.text capitalizedString] isEqualToString:[answer capitalizedString]]) {
// Do somehing
}
If you look at the NSString
class reference you will see under the heading Identifying and Comparing Strings the methods caseInsensitiveCompare:
and localizedCaseInsensitiveCompare:
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With