Feature #2984

string split with capitalize

Added by Pedro Santos almost 2 years ago. Updated 10 months ago.

[ruby-core:28744]
Status:Rejected Start date:03/18/2010
Priority:Low Due date:
Assignee: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 Yui NARUSE almost 2 years ago

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

You still want another method?

Updated by Kornelius Kalnbach almost 2 years ago

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

Updated by Kornelius Kalnbach almost 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 Yusuke Endoh almost 2 years ago

  • Assignee set to 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 Kazuhiro NISHIYAMA almost 2 years ago

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

Updated by Kazuhiro NISHIYAMA almost 2 years ago

  • Target version changed from 1.9.2 to 2.0.0

Updated by Yusuke Endoh almost 2 years ago

  • Status changed from Feedback to Rejected

Also available in: Atom PDF