I am trying to write an assistant to translate a line from "something_like_this" to "Something like this" . I use "something_like_this".titlecase to get it before "Something like this" , but I am stuck in the lower case of every uppercase letter except the first one.
I assume I'm looking for something like this:
def write_sentence string.titlecase.gsub!(/UPPERCASE-TO-LOWERCASE-EXCEPT-FIRST/)
So, in the view, I could just write string.write_sentence and return it exactly what I want. Any thoughts?
Thanks!
EDIT
I should mention that a string can sometimes be just one word, in which case the string must be converted from "something" to "something" .
CD-RUM
source share