[swift-evolution] Shortcut for creating arrays

Vladimir.S svabox at gmail.com
Fri Apr 8 12:15:59 CDT 2016


As I understand in initial message, string should be splitted by spaces, 
not all kind of whitespaces(like TAB). whiteCharacterSet() is not just 
space(at least TAB char there too).
So, if we need split just by space we need some 
componentsSeparatedBySpaceCharacter(). And IMO this is not a good solution.

Actually "a b c".componentsSeparatedByString(" ") works well, but probaly 
it will be good to have something like
"a:b-->c/d".componentsSeparatedByStrings(":", "-->", "/"). But I'm not sure 
about this :-)

On 08.04.2016 19:38, Ross O'Brien via swift-evolution wrote:
> A function that splits by whitespace would be this:
>
> "h j c
> k".componentsSeparatedByCharactersInSet(NSCharacterSet.whiteCharacterSet())
>
> 'componentsSeparatedByWhitespace' might be a nice addition as a shortcut
> for that though?


More information about the swift-evolution mailing list