C++ STL 切分字符串
来源:互联网 发布:pdf.js ajax 编辑:程序博客网 时间:2024/06/07 06:34
pattern是分隔符,如”.”。
返回被切分的一系列子串。
std::vector< std::string > splitString_STL(const std::string& str, const std::string& pattern){ std::vector<std::string> subStrings; if (str.empty()) return subStrings; std::string strs = str + pattern; size_t pos = strs.find(pattern); size_t size = strs.size(); while (pos != std::string::npos) { std::string sub = strs.substr(0,pos); subStrings.push_back(sub); strs = strs.substr(pos+1,size); pos = strs.find(pattern); } return subStrings;}
阅读全文
0 0
- C++ STL 切分字符串
- 字符串切分(c++)
- 切分字符串
- 字符串切分
- C++STL字符串
- (C/C++)UTF8字符串中字的切分
- JS切分字符串
- JS字符串的切分
- 【shell】切分字符串
- C++如何切分字符串
- C++字符串切分(split)
- js split 切分字符串
- MySQL实现切分字符串
- Python切分字符串
- 字符串切分添加逗号
- 存储过程切分字符串charindex
- perl 定长切分大字符串
- MySql切分字符串,SUBSTRING用法
- 日记:opencv3.0以后的版本变化
- 欢迎使用CSDN-markdown编辑器
- NVIDIA TK1 学习笔记(2):环境配置
- shadowsockets搭建
- poj1001在测试他给的数据结果一模一样,但总是wrong answer
- C++ STL 切分字符串
- CKEditor配置及使用
- 索引总结
- Python系列学习笔记(二)——基础语法规则
- 车牌识别系统概述
- eslint的使用 --save 和--save-dev
- Jacobi迭代法
- Token存储方式JWT
- Python神器--VirtualEnv