现在的位置: 首页 > 综合 > 正文

C++技巧之std::string常用算法[1]

2018年04月06日 ⁄ 综合 ⁄ 共 2572字 ⁄ 字号 评论关闭

STL的string已给我提供一些常用的算法(find,substr,erase,replace等),但在实现应用中远远不能满足需求,像trim,toupper,tolower这样简单的算法都不提供,我曾偶发现一个开源的C++库中简洁优雅实现了这些算法。

1.trimLeft

2.trimLeftInPlace

  

3.trimRight

4.trimRightInPlace

5.trim

6.trimInPlace

7.toUpper

8.toUpperInPlace

9.toLower

10.toLowerInPlace

抱歉!评论已关闭.