Archives

Posts Tagged ‘one-liners’

I had a post half-written for today, but decided it wasn’t going anywhere interesting and scrapped it. I still wanted to post something, so in the spirit of half-finished things, here’s a nice Ruby one-liner from a half-finished project of mine: gets.chomp.strip.scan(/[^ "]+|”[^"]+”/).map{ |s| s.delete(‘”‘) } This takes a line from standard input and splits [...]

May 4th, 2009 | Filed under Uncategorized