开发者

C++ StringTokenizer for a multichar separator [duplicate]

开发者 https://www.devze.com 2023-03-10 22:26 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: Split on substring I want to separate an std::string by a two character separator, i.e. I\'m looking for st
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

Split on substring

I want to separate an std::string by a two character separator, i.e. I'm looking for string tokenizer that can accept separators which are NOT a single character. Boost's tokenizer allows for multiple characters to be specified as separators, but this means that it'll consider any individual character as a separator, whilst what I want is to say that the separator is a particul开发者_运维百科ar sequence of characters, viz. a substring.

I'd initially thought I would quickly find the answer to this with a couple of google searches, but having just been proven wrong by a couple of wasted hours, I ask: ideas anyone?


QT's QString::split() can do this.

0

精彩评论

暂无评论...
验证码 换一张
取 消