开发者

how can i use the UTF8string for the NSArray

开发者 https://www.devze.com 2022-12-22 14:59 出处:网络
I have taken char data into database into array. now i want to convert that data into string. h开发者_高级运维ow can i convert array data into NSString.If you have a const char * instance, you can us

I have taken char data into database into array. now i want to convert that data into string.

h开发者_高级运维ow can i convert array data into NSString.


If you have a const char * instance, you can use the NSString method + stringWithCString:encoding:. For example:

NSString *_myString = [NSString stringWithCString:_myCharPtr encoding:NSUTF8StringEncoding];

To put that into an NSArray*, you might do the following:

NSArray *_myArray = [NSArray arrayWithObjects:_myString,nil];


use

[NSString stringWithUTF8String:<#(const char *)nullTerminatedCString#>]
0

精彩评论

暂无评论...
验证码 换一张
取 消