3 ms·
I don't know Ruby and reached the same conclusion in about 15 seconds. Could be nice to make it a function [or name the results] "capitalizeWords(text)". Possib
by pacala 11y ago
I don't know Ruby and reached the same conclusion in about 15 seconds. Could be nice to make it a function [or name the results] "capitalizeWords(text)". Possibly adding indentation could help:
@sentence = @sentence.
split(' ').
map!{ |x|
x = x[0..0].upcase << x[1..-1]
}.
join(' ')
[Edit: Fixed code, thanks knodi123]
- knodi123 11y agoyou want the . at the end of the line, so the interpreter knows to expect a continuation.