Anyone know what the opposite of titleize is?
I want to do 'My Title" to ‘my_title’
Anyone know what the opposite of titleize is?
I want to do 'My Title" to ‘my_title’
Eric G. wrote:
Anyone know what the opposite of titleize is?
I want to do 'My Title" to ‘my_title’
downcase and underscore
Joe
hmm, the downcase does what it is supposed to do, but the underscore
doesnt work.
i tried
“some name”.underscore
=> “some name”
Thus, it gives me the same thing, any ideas?
Joe R. MUDCRAP-CE wrote:
Eric G. wrote:
Anyone know what the opposite of titleize is?
I want to do 'My Title" to ‘my_title’
downcase and underscore
Joe
Ah, appears underscore only works on camelCasedWords. Probably have to
resort to the swiss army knife:
‘foo bar blah’.gsub(/\s/, ‘_’)
Joe
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs