Hacker News new | ask | show | jobs
by knodi123 3753 days ago
Why use "map!"? you're already working on a disposable copy of your data, there's no need to mandate "in place".

Could this be done with one gsub regex?

why use "x = x[0..0].upcase << x[1..-1]", instead of "x[0]=x[0].upcase; x" ?

And why not use the already-written "titleize" function, which capitalizes the first letter of each word?

Frankly, I think your darling needs to be put out of its misery. :-)

1 comments

> already-written "titleize" function

Which is a function provided by ActiveSupport. It's not part of Ruby itself.