Boost logo

Boost :

From: Thore Karlsen (sid_at_[hidden])
Date: 2005-07-13 08:56:45


On Wed, 13 Jul 2005 15:12:48 +0200, Stefan Slapeta <stefan_at_[hidden]>
wrote:

>hi,
>
>I assume the behaviour of boost::split not to return the last token has
>been changed (in CVS). However, a side effect seems to be that there is
>also one token returned for _empty_ strings, which is very questionable IMO!
>
>summary (if '/' is the separator):
>
>boost 1.32:
>"" -> 0 tokens
>"abc/abc" -> 2 tokens
>"abc/abc/" -> 2 tokens
>
>CVS:
>"" -> 1 token (!)
>"abc/abc" -> 2 tokens
>"abc/abc/" -> 3 tokens
>
>should be IMO:
>"" -> 0 tokens
>"abc/abc" -> 2 tokens
>"abc/abc/" -> 3 tokens
>
>
>Thoughts?

In some ways I agree with you, but I think it may be more consistent to
output an empty token for an empty string as long as other empty tokens
are kept. However, I can see arguments for and against both ways.

Does anyone know what other libraries/languages do in this situation?
Scripting languages typically have a split() function, but I haven't
tested this particular case.

-- 
Be seeing you.

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk