سؤال

Can I assign a char* or wchar_t* to the NSString and completely avoid copying some how?

I need to pass Unicode (utf16 LE) string from SpiderMonkey to UIView subclass, and my goal is to avoid copying if possible, or at least avoid intermediate conversion to UTF8.

Thank you.

هل كانت مفيدة؟

المحلول

See - (instancetype)initWithBytesNoCopy:(void *)bytes length:(NSUInteger)length encoding:(NSStringEncoding)encoding freeWhenDone:(BOOL)flag method of NSString class.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top