简体   繁体   English

wstring的isupper和islower

[英]isupper and islower for wstring

I have a std::wstring and I want to find which character are upper case and which ones are lowercase. 我有一个std :: wstring,我想找到哪个字符是大写字母,哪个字符是小写字母。 the std::isupper and islower seems to work on ASCII characters only but I want to be able to find out all kinds of uppercase and lowercase characters std :: isupper和islower似乎仅适用于ASCII字符,但我希望能够找出各种大写和小写字符

eg á is an "Latin small letter a with acute" and Á is an "Latin capital letter A with acute" similarly ä and Ä are lower and upper case german letters. 例如,á是“带小写的拉丁小写字母a”,而Á是“带小写的拉丁大写字母A”,类似地ä和Ä是大小写的德国字母。

Is there any function (mfc, boost or in any other library) which I can use to find out if a character is lower or upper case (irrespective of the locale)? 是否可以使用任何函数(mfc,boost或任何其他库中)来确定字符是小写还是大写(与语言环境无关)?

Thanks in advance 提前致谢

Rahul 拉胡尔

Most implementations are going to provide iswXxx functions, ie iswupper and iswlower . 大多数实现都将提供iswXxx函数,即iswupperiswlower The big problem is that the encoding used in wide character strings is undefined and therefore which values are determined as upper and lower case are really up to the target platform. 最大的问题是,宽字符串中使用的编码是不确定的,因此哪些值被确定为大写和小写,实际上取决于目标平台。 (Note that the iswXxx functions are not in the standard) (请注意,iswXxx函数不在标准中)

EDIT: And Bill is an idiot! 编辑:比尔是个白痴! The template declared in <locale> for std::isupper accepts both char s and wchar_t s. <locale>std::isupper声明的模板同时接受charwchar_t (But it requires a locale object) (但是它需要一个语言环境对象)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM