[ACCEPTED]-Convert const char* string to NSString with length AND encoding-objective-c++
Accepted answer
If your const char* variable is named foo
(and 5 it points to a null-terminated string), just 4 say
[NSString stringWithUTF8String:foo]
Because UTF-8 is a superset of ASCII, this 3 will work whether foo
points to UTF-8 or ASCII. Then 2 you can move up to full Unicode with no 1 problems.
Use:
[NSString initWithBytes:length:encoding].
0
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.