对于英语以外的人物的上层问题 [英] To upper issue for characters other than english
本文介绍了对于英语以外的人物的上层问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
to upper不适用于希伯来字符。
功能解释如下:
strItem.SetAt(0,:: toupper(strItem [0]));
给出一些垃圾字符。请告诉我这个问题。
我尝试了什么:
to upper is not working for Hebrew characters .
the function is explained below :
strItem.SetAt(0, ::toupper(strItem[0]));
giving some garbage characters .please let me know the issue.
What I have tried:
if ( lpszItem && *lpszItem )
{
strItem = lpszItem;
if ( m_bUpper1st )
{
if ( *lpszItem == _T('~') || *lpszItem == _T('*') )
strItem.SetAt(1, ::toupper(strItem[1]));
else
{
//int i = ::toupper(strItem[0]);
strItem.SetAt(0, ::toupper(strItem[0]));
///strItem.MakeUpper();
//strItem.Trim();
}
}
}
推荐答案
有两个版本的toupper
:
C库版本 toupper - C ++参考a> [ ^ ]和C ++版本toupper - C ++参考a> [ ^ ](不要被相同的链接标题混淆)。
两者都支持指定用于转换的语言环境。
默认的C库语言环境是C,它是ASCII,可以用 setlocale - C ++参考a> [ ^ 。但请注意,这会影响所有C库函数。
对于C ++库语言环境,请参阅 locale - C ++参考a> [ ^ ]。
但您使用的是Windows和Unicode构建相关的T
字符串。
对于那些使用相应的_t
函数(这里_totupper
;参见toupper,_toupper,towupper,_toupper_l,_towupper_l [ ^ ])。
但是你必须先设置语言环境(参见语言环境) [ ^ ]和setlocale,_wsetlocale [ ^ ])。
试试这个:
There are two versions oftoupper
:
The C library version toupper - C++ Reference[^] and the C++ version toupper - C++ Reference[^] (don't be confused by the identical link title).
Both support specifying a locale to be used for conversion.
The default C library locale is "C" which is ASCII and can be changed with setlocale - C++ Reference[^]. But note that this affects all C library functions.
For the C++ library locale see locale - C++ Reference[^].
But you are using Windows and the Unicode build dependantT
strings.
For those use the corresponding_t
functions (here_totupper
; see toupper, _toupper, towupper, _toupper_l, _towupper_l[^] ).
But again you have to set the locale first (see Locale[^] and setlocale, _wsetlocale[^]).
Try this:
// Once on top of function / thread / process
// "" is user default ANSI code page
// ".ACP" is system ANSI code page
// ".<cp>" is code page number; e.g. ".1255"
setlocale(LC_ALL, "");
// ...
strItem.SetAt(0, _totupper(strItem[0]));</cp>
这篇关于对于英语以外的人物的上层问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文