Feature #2984

string split with capitalize

Added by pedromfs (Pedro Santos) about 2 years ago. Updated about 1 year ago.

[ruby-core:28744]
Status:Rejected Start date:03/18/2010
Priority:Low Due date:
Assignee:mame (Yusuke Endoh) % Done:

0%

Category:core
Target version:2.0.0

Description

It would be awesome if string had a method to perform this action:

string.split(' ').each{ |s| s.capitalize! }.to_s

History

Updated by naruse (Yui NARUSE) about 2 years ago

try string.gsub(/\w+/){$&.capitalize}

You still want another method?

Updated by murphy (Kornelius Kalnbach) about 2 years ago

It has: http://www.ruby-doc.org/core/classes/String.html#M000799

Updated by murphy (Kornelius Kalnbach) about 2 years ago

Oh, I'm sorry...you want String#titleize: http://railsapi.com/doc/rails-v2.3.5/classes/ActiveSupport/Inflector.html#M002755

Updated by mame (Yusuke Endoh) about 2 years ago

  • Assignee set to mame (Yusuke Endoh)
  • Target version set to 1.9.2
Hi,

Pedro, do you still want the method?

I'll close the ticket unless you answer to suggestions by Naruse
and Kornelius.

-- 
Yusuke Endoh <mame@tsg.ne.jp>

Updated by znz (Kazuhiro NISHIYAMA) about 2 years ago

  • Category set to core
  • Status changed from Open to Feedback

Updated by znz (Kazuhiro NISHIYAMA) about 2 years ago

  • Target version changed from 1.9.2 to 2.0.0

Updated by mame (Yusuke Endoh) about 2 years ago

  • Status changed from Feedback to Rejected

Also available in: Atom PDF