开发者

isupper and islower for wstring

开发者 https://www.devze.com 2023-01-29 09:45 出处:网络
I have a std::wstring and I开发者_如何学C want to find which character are upper case and which ones are lowercase. the std::isupper and islower seems

I have a std::wstring and I开发者_如何学C 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

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.

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

Thanks in advance

Rahul


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)

EDIT: 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)

0

精彩评论

暂无评论...
验证码 换一张
取 消