• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
RE: Converting NSString to char constant (answered)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.
  • Follow-Ups:
    • Re: Converting NSString to char constant (answered)
      • From: Clark Cox <email@hidden>
  • Prev by Date: Re: [OT] Encryption
  • Next by Date: Re: [OT] Encryption
  • Previous by thread: Antialiasing and printing
  • Next by thread: Re: Converting NSString to char constant (answered)
  • Index(es):
    • Date
    • Thread