在 Obj C 中编码
Encoding in Obj C
NSString *s = [NSString stringWithCString:"Long dash symbol \xe2\x80\x94" encoding:(NSUTF8StringEncoding) ];
NSString *t = [NSString stringWithUTF8String:"Long dash symbol \xe2\x80\x94" ];
这两行有什么区别吗?
不,两种方法都调用
- (instancetype)initWithBytes:(const void *)bytes
length:(NSUInteger)len
encoding:(NSStringEncoding)encoding;
NSString *s = [NSString stringWithCString:"Long dash symbol \xe2\x80\x94" encoding:(NSUTF8StringEncoding) ];
NSString *t = [NSString stringWithUTF8String:"Long dash symbol \xe2\x80\x94" ];
这两行有什么区别吗?
不,两种方法都调用
- (instancetype)initWithBytes:(const void *)bytes
length:(NSUInteger)len
encoding:(NSStringEncoding)encoding;