NSString compare: options: range: - what value to pass without parameters?

I want to call [NSString compare: options: range:] and not pass any parameters.

What should be the correct value for the parameter parameter?

Both nil and NULL raise a warning in Xcode: "Incompatible pointer to integer conversion sending" void * "to a type parameter ..."

+7
source share
3 answers

Just go through 0 . Alternatively, if you have visited the Mac block several times, you can catch the passage kNilOptions , which is just another name for 0 , but implies the corresponding flags.

+9
source

You must pass 0 . The options argument is a bit mask, which actually means that it is just an integer. This is also why the warning says "integer conversion".

+2
source

According to Apple Docs:

Search parameters - you can combine any of the following actions using the bitwise OR operator: NSCaseInsensitiveSearch, NSLiteralSearch, NSNumericSearch. See the String Programming Guide for more information on these options.

NSCaseInsensitiveSearch : NSCaseInsensitiveSearch search.

NSLiteralSearch : Exact symbolic equivalence.

NSNumericSearch : The numbers in the strings are compared using a numeric value, i.e. Name2.txt <Name7.txt <Name25.txt.

String Programming Guide

0
source

All Articles