3 ms·
I would call that underengineered. This could be more generic, both in what it operates on (why only strings and not any sequence of value items?) and what it s
by Someone 9y ago
I would call that underengineered. This could be more generic, both in what it operates on (why only strings and not any sequence of value items?) and what it separates on (why only Unicode whitespace? It could be used as return value from a call that iterates over CSV fields in a line or that finds regex matches in a string).
- burntsushi 9y agoSplitWhitespace is a convenience. Its underlying internal type is actually: Filter<Split<'a, IsWhitespace>, IsNotEmpty> The split[1] method is generic, and for example, one can indeed use a regex for it. (I wouldn't use it for CSV though, since it would almost certainly be wrong.) [1] - https://doc.rust-lang.org/std/primitive.str.html#method.split https://doc.rust-lang.org/std/primitive.str.html#method.spli...