Challenge: finding more NSString methods


#1

The challenge asks to “find the method” for a case-insensitive search.

I looked in the docs, and found that rangeOfString: “Invokes rangeOfString:options: with no options.”

If you look at rangeOfString:options:, one of the options is NSCaseInsensitiveSearch (this is not a method, right?).

Is there a method to use instead, or should the challenge have asked for an option (instead of a method), or is this option somehow also a method?


#2

NSCaseInsensitiveSearch is not a method; it is an option name (for a constant value), defined in an enum.

Although you can use the methods rangeOfString: or rangeOfString:options:, there is a cover method: caseInsensitiveCompare: (which invokes “compare:options: with NSCaseInsensitiveSearch …”) which you might find easier to use.


#3

Thank you.