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
NSStringclass reference you will see under the heading Identifying and Comparing Strings the methodscaseInsensitiveCompare:andlocalizedCaseInsensitiveCompare:.