C ++ 11不区分大小写的字符串开头比较(unicode) [英] C++11 case insensitive comparison of beginning of a string (unicode)

查看:758
本文介绍了C ++ 11不区分大小写的字符串开头比较(unicode)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须检查特定字符串是否以另一个字符串开头。字符串使用utf8编码,比较应该不区分大小写。

I have to check if the particular string begins with another one. Strings are encoded using utf8, and a comparison should be case insensitive.

我知道这与该主题非常相似 C ++中的不区分大小写的字符串比较但是我不想使用boost库,我更喜欢可移植的解决方案不可能,我更喜欢Linux定向解决方案)。

I know that this is very similar to that topic Case insensitive string comparison in C++ but I do not want to use the boost library and I prefer portable solutions (If it is 'nearly' impossible, I prefer Linux oriented solutions).

在C ++ 11中使用它的regexp库可能吗?或者只是使用简单的字符串比较方法?

Is it possible in C++11 using its regexp library? Or just using simple string compare methods?

推荐答案

我知道的唯一方式是UTF8 /国际化/文化感知是优秀且维护良好的 IBM ICU:Unicode的国际组件。它是一个用于* nix或Windows的C / C ++库,其中大量的研究提供了一个文化感知的字符串库,包括快速和准确的不区分大小写的字符串比较。

The only way I know of that is UTF8/internationalization/culture-aware is the excellent and well-maintained IBM ICU: International Components for Unicode. It's a C/C++ library for *nix or Windows into which a ton of research has gone to provide a culture-aware string library, including case-insensitive string comparison that's both fast and accurate.

IMHO,你不应该写自己,除非你做论文论文是加密和文化敏感的字符串库。

IMHO, the two things you should never write yourself unless you're doing a thesis paper are encryption and culture-sensitive string libraries.

这篇关于C ++ 11不区分大小写的字符串开头比较(unicode)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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