
13 Jul
2005
13 Jul
'05
2:42 p.m.
Thore Karlsen <sid@6581.com> writes:
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.
Like John said: python -c "print ''.split('/'), 'abc/abc'.split('/'), 'abc/abc/'.split('/')" [''] ['abc', 'abc'] ['abc', 'abc', ''] -- Dave Abrahams Boost Consulting www.boost-consulting.com