How to convert an NSString to Char

Another quick tip!
If you need to convert from an NSString format to a Char format, it’s a really easy one line of code as follows;
const char *fooBar = [barFoo UTF8String];
Here, fooBar is your new Char and barFoo is your previously allocated NSString.
Simple!
Cheers
Graham

Another quick tip!

If you need to convert from an NSString format to a Char format, it’s a really easy one line of code as follows;

const char *fooBar = [barFoo UTF8String];

Here, fooBar is your new Char and barFoo is your previously allocated NSString.

Simple!

Cheers

Graham

Tagged with:
 

2 Responses to “How to convert an NSString to Char”

  1. rayland says:

    Yes nice but does not convert accentuated strings… Still looking for a simple way to do it :)

  2. sherlockly says:

    oh,i see!thanks!

Leave a Reply




Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!