• string::find_last_of


    今天在代码中用到string的这个方法,一不小心就用错了。

    这是http://www.cplusplus.com/关于这个方法的解释。

    Find character in string from the end

    Searches the string for the last character that matches any of the characters specified in its arguments.

    When pos is specified, the search only includes characters at or before position pos, ignoring any possible occurrences after pos.

     这里解释说:在指定的字符串中搜索最靠后的任意匹配的字符或者字符串,如果指定了pos,那么搜索范围只会在pos之前以及pos处的字符,不会考虑之后的字符。


    我就错了这个地方,我以为搜索不会搜索pos处的字符呢

    要小心这些细节处的东西,否则会让你很难受呢,感觉自己代码写对了,但是结果就是不对,主要还是对C++库的使用不熟练。

  • 相关阅读:
    zfs
    targetcli
    targetcli
    自动制linux iso包
    yum解决重复包,依赖冲突问题
    lvm相关
    vmware相关
    配置本地yum源
    k8s安装prometheus监控
    流水线基础-Pipeline
  • 原文地址:https://www.cnblogs.com/lit10050528/p/4188922.html
Copyright © 2020-2023  润新知