`split` on `Whitespace` and `splitWhitespace` are not equivalent: 
    
    
    from strutils import split, splitWhitespace
    let s = "  a couple of \t words "
    echo s.split.len            # prints 9
    echo s.splitWhitespace.len  # prints 4
    

In case of leading whitespace `split(maxsplit = 1)[0]` is empty string while I 
expect `splitWhitespace(maxsplit = 1)` be the first non-whitespace token in the 
string. Sure, one can strip the leading whitespace before using `split()`, etc.

But as I see, all the functionality for `splitWhitespace(maxsplit = 
<something>)` is already there, it is just not exposed via public 
`splitWhitespace` interface.

The question is "why?" Is it buggy or what? 

Reply via email to