3 ms·
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
by knodi123 11y 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. :-)
- boxidea 11y ago> already-written "titleize" function Which is a function provided by ActiveSupport. It's not part of Ruby itself.