3D file reader

Len

Registered
I am trying to write a Wavefront .obj 3D file reader in Cocoa and am running into simple problems like comparing NSString variables to explicit strings like:
if (MyNSString == 'v 12') {

blah

}

I'm used to PERL where this is all very easy.
Cocoa has oodles of special methods for dealing with such things, I suspect, but I haven't found a good resource to be able to do simple things like the above.
I have looked through "Learning Cocoa" (the book) and the developer examples that came pre-installed but they all seem to avoid the above scenario and provide little help.
The Developer Help Center very tool rarely turns up useful info too (and is not even text searchable like an HTML page and drives me nuts).
Is there some magical resource for this kind of thing I'm missing?
I'm getting rather frustrated.
Thanks for any help! -Len
 

blb

`'
First, about what you're trying to do with NSString; you need to realize that, unlike Perl, C (and by extension Objective C) doesn't have true support for strings in the language, so using == or something similar doesn't work. To compare NSString's, there are a number of messages you can send the NSString: compare:, caseInsensitiveCompare:, and other variations on compare.

As far as documentation, I've found the best sources include the Foundation and AppKit PDF and html files (under /Developer/Documentation/Cocoa/Reference/Foundation/ObjC_classic and /Developer/Documentation/Cocoa/Reference/ApplicationKit/ObjC_classic), and the header files for these (/System/Library/Frameworks/AppKit.framework/Headers and /System/Library/Frameworks/Foundation.framework/Headers).
 

shtjonathan

Registered
Hi,

In your case you should write:

if ([MyNSString isEqualToString:mad:"v 12"]) {
//blah...
}

Good luck!
 

rharder

Do not read this sign.
In other words, you were comparing memory addresses when you used the == operator.

-Rob
 
Top