NSString到wchar_t *? [英] NSString to wchar_t*?
本文介绍了NSString到wchar_t *?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我似乎找不到一个很好的内置方式将NSString转换为wchar_t ...任何提示如何做到这一点?任何苹果公开在NSString类是c字符串(char *)或unichars,但没有wchar *。
I can't seem to find a good built-in way to convert an NSString to wchar_t... any tips on how to do this? Anything Apple exposes on the NSString class is for c-strings (char*) or for unichars, but nothing for wchar*.
推荐答案
[urString cStringUsingEncoding:NSUTF16LittleEndianStringEncoding]
wchar_t
是编译器特定的。假设你有Win32 wchar_t
,那么UTF16很少的结尾编码会做到。对于Unix wchar_t
,您可能需要NSUTF32编码系列,您的平台选择端序。
wchar_t
is compiler specific. Assuming you wan the Win32 wchar_t
, then UTF16 little ending encoded will do it. For Unix wchar_t
you may need the NSUTF32 encoding family, with your platform of choice endianess.
这篇关于NSString到wchar_t *?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文