How to split a string with a delimiter larger than one single char?

Posted by Nazgulled on Stack Overflow See other posts from Stack Overflow or by Nazgulled
Published on 2010-03-28T01:41:04Z Indexed on 2010/03/28 3:13 UTC
Read the original article Hit count: 380

Hi,

Supposing I have this:

"foo bar 1 and foo bar 2"

How can I split it into:

foo bar 1
foo bar 2

?

I tried strtok() and strsep() but neither worked. They don't recognize "and" as delimiter, they recognize "a", "n" and "d" as delimiters.

Any function to help me with this or I'll have to split by the blank space and do some string manipulation?

© Stack Overflow or respective owner

Related posts about string-manipulation

Related posts about string-split