Returns a string created by copying the data from a given C array of UTF8-encoded bytes.
+ (id)stringWithUTF8String:(const char *)bytes
Parameters of [NSString stringWithUTF8String]
- bytes
- A
NULL
-terminated C array of bytes in UTF8 encoding.
Return Value of [NSString stringWithUTF8String]
A string created by copying the data from bytes.
Example of [NSString stringWithUTF8String]
- (void) deviceListenerCallback:(DeviceEventTypeDef)type data:(void*)data
{
DeviceInfoDef* o = (DeviceInfoDef*)data;
NSString *deviceName;
if (o != NULL)
deviceName = [NSString stringWithUTF8String:o->DeviceName];
else
deviceName = @"";
Example of [NSString stringWithUTF8String]
char t = 'A' + i;
char s[2]; s[0] = t; s[1] = '\0';
NSString* alphabetString = [NSString stringWithUTF8String: s];
Example of [NSString stringWithUTF8String]
NSString *str = @"Name: ";
NSString *name = [NSString stringWithUTF8String:user.name];
str = [str stringByAppendingString:name];