Re: [swift-evolution] Shortcut for creating arrays

2016-04-09 Thread Radosław Pietruszewski via swift-evolution
FWIW, in Swift 3: “h j c k”.componentsSeparated(by: “”) or “h j c k”.componentsSeparatedByCharacters(in: .whitespace()) which is slightly better. Regarding the proposal, I love Ruby’s %w(foo bar) and other nice shortcuts like that, but short-term I think we have bigger problems in Swift. I

Re: [swift-evolution] Shortcut for creating arrays

2016-04-08 Thread Dave Abrahams via swift-evolution
on Fri Apr 08 2016, Arsen Gasparyan wrote: > I want to find a conciseness and simplicity solution. But > componentsSeparatedByCharactersInSet(NSCharacterSet.whiteCharacterSet()) > scares > me :) Yes, we should have words.split() at some point. IMO this is in scope

Re: [swift-evolution] Shortcut for creating arrays

2016-04-08 Thread Tino Heth via swift-evolution
I would create a computed property on String and call it "words" Tino ___ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution

Re: [swift-evolution] Shortcut for creating arrays

2016-04-08 Thread Vladimir.S via swift-evolution
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

Re: [swift-evolution] Shortcut for creating arrays

2016-04-08 Thread Arsen Gasparyan via swift-evolution
I want to find a conciseness and simplicity solution. But componentsSeparatedByCharactersInSet(NSCharacterSet.whiteCharacterSet()) scares me :) On Fri, Apr 8, 2016 at 7:39 PM James Campbell wrote: > Exactly > > Sent from Supmenow.com > > > > > On Fri,

Re: [swift-evolution] Shortcut for creating arrays

2016-04-08 Thread Vladimir.S via swift-evolution
On 08.04.2016 17:05, Ross O'Brien via swift-evolution wrote: Well, you can do this already: let words = "rats live on no evil star".componentsSeparatedByString(" ") so I don't know how much a shortcut is needed. Also thought about componentsSeparatedByString, clearly says what we have, what

Re: [swift-evolution] Shortcut for creating arrays

2016-04-08 Thread James Campbell via swift-evolution
Pehaps we could have a function that splits by whitespace. "h j c k".split() *___* *James⎥Alex's Minder* *ja...@supmenow.com ⎥supmenow.com * *Sup* *Runway East * *10 Finsbury Square* *London* * EC2A 1AF * On 8 April

Re: [swift-evolution] Shortcut for creating arrays

2016-04-08 Thread Ross O'Brien via swift-evolution
Well, you can do this already: let words = "rats live on no evil star".componentsSeparatedByString(" ") so I don't know how much a shortcut is needed. And given '%w' would currently be impossible in Swift as an operator containing a letter, is there a Swiftier function name or operator for this?

[swift-evolution] Shortcut for creating arrays

2016-04-08 Thread Arsen Gasparyan via swift-evolution
Hey guys, Very often we need to create an array strings. It's a routine task and I really like shortcut in Ruby that shortcut makes everyday coding a little bit easier and fun: words = %w[rats live on no evil star] What do you think about adding something like this in Swift? Cheers, Arsen