3

I am new in C++. I am trying to split a string which is like

<a:cb>:"dfddff:gh":[mjddl:]

My delimiter is :, and entries inside <>, "" or [] should not be split. The output should be

a:cb
dfddff:gh
mjddl:

I want to create a function which takes the following parameters

SplitString(string StringToSplit,char delimiter,vector<char>escapeStartList,vector<char>escapeEndList)

Just wanted to know if there is something already existing like this in standard library or boost.

Most of the answer on stackoverflow provides escape sequence of quotation, here i want to use escape start and end.

user2799564
  • 147
  • 2
  • 8
  • 3
    See the answers to this question: http://stackoverflow.com/questions/236129/split-a-string-in-c – BrunoLevy Jul 28 '15 at 09:38
  • 2
    There is no standard way to do this. Either you split the string manually by yourself (referencing here: http://stackoverflow.com/questions/236129/split-a-string-in-c?rq=1) or you could use regular expressions which you can use when you include the `#include` header-file – mbed_dev Jul 28 '15 at 09:40
  • 3
    Check Boost tokenizer, it should do most of work: http://www.boost.org/doc/libs/1_58_0/libs/tokenizer/ – Hcorg Jul 28 '15 at 09:41

0 Answers0