Re: best way to test for NSString / NSCFString type of object?
Re: best way to test for NSString / NSCFString type of object?
- Subject: Re: best way to test for NSString / NSCFString type of object?
- From: Nick Zitzmann <email@hidden>
- Date: Thu, 2 Oct 2003 17:56:01 -0700
On Thursday, October 2, 2003, at 05:32 PM, Ben Dougall wrote:
it never successfully detected a string. i printed out the object
types to see what was going on and the NSStrings had unexpectedly
turned into the class type NSCFString. changing the test to that then
worked fine, but is that safe? will it always be NSCFString rather
than NSString? what's the best way to make that test? and how come
it's changed?
NSString, IIRC, is a class cluster, so that explains the behavior
you're seeing. What you might want to do instead is this...
if ([[array lastObject] isKindOfClass:[NSString class]])
That ought to work for all different NSString classes, public or
private.
Nick Zitzmann
AIM/iChat: dragonsdontsleep
Check out my software page:
http://seiryu.home.comcast.net/
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my
telephone." - Bjarne Stroustrup
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.