Boost库之字符串处理

equals

    assert(boost::equals("boost", "boost"));  
    assert(!boost::equals("boost", "BOOST"));  
    assert(boost::iequals("boost", "BOOST"));  

all ,  如果它的所有元素满足一个给定的通过判断式描述的条件,则这个条件式成立。

    assert(boost::all("\x20\t\n\r", boost::is_space()));   
    assert(boost::all("\x20\t\n\r", boost::is_classified(std::ctype_base::space)));  
    assert(boost::all("\x20\t\n\r", boost::is_any_of("\x20\t\n\r")));  
    assert(boost::all("abcde", boost::is_from_range('a','e')));  
    assert(boost::all("abcde", boost::is_from_range('a','z')));  
    assert(!boost::all("abcde", boost::is_from_range('b','c')));  
    assert(boost::all("abc __ de", boost::is_from_range('a','z') || boost::is_space() || boost::is_any_of("_")));  
starts_with

    assert(boost::starts_with("boost_python-vc100-mt-1_49.dll", "boost"));  
    assert(!boost::starts_with("boost_python-vc100-mt-1_49.dll", "BOOST"));  
    assert(boost::istarts_with("boost_python-vc71-mt-1_33.dll", "BOOST"));
ends_with

    assert(boost::ends_with("boost_python-vc100-mt-1_49.dll", ".dll"));  
    assert(!boost::ends_with("boost_python-vc100-mt-1_49.dll", ".DLL"));  
    assert(boost::iends_with("boost_python-vc100-mt-1_49.dll", ".DLL"));  
contains

    assert(boost::contains("boost_python-vc100-mt-1_49.dll", "python"));  
    assert(!boost::contains("boost_python-vc100-mt-1_49.dll", "PYTHON"));  
    assert(boost::icontains("boost_python-vc100-mt-1_49.dll", "PYTHON"));  
is_space: 字符是否为空格  
is_alnum: 字符是否为字母和数字字符  
is_alpha: 字符是否为字母  
is_cntrl: 字符是否为控制字符  
is_digit: 字符是否为十进制数字  
is_graph: 字符是否为图形字符  
is_lower: 字符是否为小写字符  
is_print: 字符是否为可打印字符  
is_punct: 字符是否为标点符号字符  
is_upper: 字符是否为大写字符  
is_xdigit: 字符是否为十六进制数字  
is_any_of: 字符是否是参数字符序列中的任意字符  
is_from_range 字符是否位于指定区间内,即from <= ch <= to  








  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值