Project

General

Profile

Actions

Feature #4822

closed

String#capitalize improvements

Added by yeban (Anurag Priyam) almost 13 years ago. Updated about 12 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
[ruby-core:36714]

Description

I think it would be helpful if String#capitalize could capitalize sentences, and not just the first letter of a string. We could optionally pass a regexp to identify sentence boundaries. If we don't pass this parameter capitalize behaves as before.

s = "hey all! wassup? i am good."

current capitalize

s.capitalize #=> "Hey all! wassup? i am good."

new capitalize

s.capitalize #=> "Hey all! wassup? i am good."
s.capitalize(/[?!.] /) #=> "Hey all! Wassup? I am good."

I am not sure what would it take to implement this.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0