Re: A bit stumped....
Re: A bit stumped....
- Subject: Re: A bit stumped....
- From: "Andre Benassi" <email@hidden>
- Date: Fri, 20 Jul 2001 09:54:52 -0500
Cocoa NSStrings do not work like standard C Strings. You cannot compare
them using ==. Instead you need to send them as a message:
if ([rwdString isEqualToString:readString]) NSLog (@"It's equal to Read");
..... etc etc.
The reason is that NSStrings are Objects, and thus comparing them with ==
compares the _address_ of the objects. In your case, the two Addresses will
never be the same, and you will never get a match.
For a nice tutorial on Strings, visit
http://www.oreillynet.com/pub/ct/37.
This is Mike Beam's Cocoa page through O'Reilly. His two most recent
articles deal with Strings. I am new to Cocoa, so I am happy to answer your
question because by reading Mike's articles, this is one of the few things I
really understand. :D
Andre