uttam
uttam

Reputation: 1364

how can i use the UTF8string for the NSArray

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

how can i convert array data into NSString.

Upvotes: 0

Views: 450

Answers (2)

maxbareis
maxbareis

Reputation: 886

use

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

Upvotes: 0

Alex Reynolds
Alex Reynolds

Reputation: 96966

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];

Upvotes: 1

Related Questions