string analysis

I am working on a project of text analysis, which includes the following scenario:

Assume that I have a string composed of several sentences:

First sentence. Second sentence? Third sentence!

We can accept a set of separators, including . ! ?

How to store these three sentences into a three element char array?

Thx.
Last edited on
Boost.Tokenizer can be used to tokenize a string given multiple delimiting characters. See the example here:
http://www.boost.org/doc/libs/1_37_0/libs/tokenizer/char_separator.htm

Aside from that, consider doing it manually. You could either use the find_if algorithm supplied with a functor predicate to identify delimiters or just do a simple traversal and check for them one at a time.

Just some ideas (presented in order of awesomeness).
Topic archived. No new replies allowed.