本文介绍了如何使UNI code字小写字母的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在转换为降低一个CString Variable.so,英语MakeLower(在VC ++ MFC。我UNI code字符字母都UNI code字问题)工作正常,我也得到小写。但它不能转换UNI code字来降低case.I曾尝试STL的算法转换:

I have problem in converting to lower case letters for unicode characters in VC++ MFC .I have unicode characters in a CString Variable.so,with English MakeLower() works fine and I get lower case .But it cannot convert unicode characters to lower case.I did try the STL algorithm transform :

的std ::字符串数据=ИИИЛЛЛЛ; // bulgerian字符

std::string data = "ИИИЛЛЛЛ"; //bulgerian chars

的std ::变换(data.begin(),data.end(),data.begin(),tolower的::);

std::transform(data.begin(), data.end(), data.begin(), ::tolower);

但它无法加载UNI code字符,我得到????符号到位UNI code字符的。

but it fails to load the unicode chars ,I get "????" symbols in place of unicode chars .

能否请您让我知道如果有一个单向code字符。我不喜欢提前使用boost libraries.Thanks的解决方案!

Can you please let me know if there is a solution for unicode chars .I dont like to use boost libraries.Thanks in advance!

推荐答案

如果您的项目使用的统一code字符集(项目属性), CString的:: MakeLower()应该努力 - 注意,这将不转换字符串的内容,它返回一个新字符串,请参阅的:

If your project uses the Unicode Character Set (project properties), CString::MakeLower() should work -- , it returns a new string, see this MSDN article:

CString s1(_T("ABC")), s2;
s2 = s1.MakeLower();
ASSERT(s2 == _T("abc"));

修改:CString的:: MakeLower()不会改变字符串的contentrs,它也返回到转换后的字符串的引用

EDIT: CString::MakeLower() does change the contentrs of the string, it also returns a reference to the converted string

这篇关于如何使UNI code字小写字母的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 14:06