wstring的isupper和islower [英] isupper and islower for wstring

查看:63
本文介绍了wstring的isupper和islower的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个std :: wstring,我想找出哪个字符在上面大小写,哪些是小写.std :: isupper和islower似乎只能处理ASCII字符,但我希望能够找出全部各种大写和小写字符

I have a std::wstring and I want to find which character are upper case and which ones are lowercase. 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

例如á是带有小写字母的拉丁小写字母a"Á是带大写字母的拉丁大写字母A"相似地,ä和Ä是大小写的德国字母.

e.g. á 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.

我是否可以使用任何功能(mfc,boost或任何其他库中)用于查找字符是小写还是大写(与语言环境无关)?

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)?

预先感谢

拉胡尔

推荐答案

大多数实现都将提供iswXxx函数,即 iswupper iswlower .最大的问题是,宽字符串中使用的编码是不确定的,因此哪些值被确定为大写和小写,实际上取决于目标平台.(请注意,iswXxx函数不在标准中)

Most implementations are going to provide iswXxx functions, i.e. iswupper and iswlower. 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)

比尔是个白痴!在 std :: isupper < locale> 中声明的模板接受 char s和 wchar_t s.(但是它需要一个语言环境对象)

And Bill is an idiot! The template declared in <locale> for std::isupper accepts both chars and wchar_ts. (But it requires a locale object)

这篇关于wstring的isupper和islower的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆