The discussions I found about setting NSString constants made me code it the following way:
.h file:
extern NSString * const kSectionHeaders;
==
does pointer comparison, it won't compare the values of two objects. isEqualToString:
(and in general isEqual:
) is the right way to do this - where was it described as a "bad solution"?
Remember variable names are just pointers to objects in memory.
The ==
operand compares the pointers. It will not be true unless it is comparing the exact same object in memory.
isEqualToString:
is your best bet. Don't worry too much about speed. The devices are plenty fast enough to do the comparison in the blink of an eye. The things that really take noticible time are drawing on screen and reading from disk.
Who described that as a bad solution? It is the only proper/correct solution to the problem at hand.