RE: Converting NSString to char constant (answered)
RE: Converting NSString to char constant (answered)
- Subject: RE: Converting NSString to char constant (answered)
- From: KLW <email@hidden>
- Date: Fri, 02 Jan 2004 17:24:34 -0500
Answered my own question:
char cResult = (char)[resultasNSString characterAtIndex:0];
Anyone have a better, smaller, faster way?
Kristofer
[snip]
>I'm getting a one character NSString as a return value. I want to
throw >it into a switch() case construct in order to not have to make
the code >go through a dozen else if tests.
>
>However, switch() only takes an int or char as it's parameter.
>
>I've looked at the C-string methods in NSString, but obviously, they
>return C strings, not char constants.
[snip]
_______________________________________________
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.