diff options
author | Gareth Rees <gareth@mysociety.org> | 2015-01-23 15:12:50 +0000 |
---|---|---|
committer | Gareth Rees <gareth@mysociety.org> | 2015-02-04 15:02:00 +0000 |
commit | 93c137a906715c194dc64044556c148d813c87a3 (patch) | |
tree | c7479f296aa16b9eb50a0bcea6edd08daa5104dc /spec/controllers/request_controller_spec.rb | |
parent | 3fe8f773df749988a1d88141330e65b13eb43ab6 (diff) |
Nicer capitalize first letter only
String#capitalize downcases remaining letters, so:
> 'heLLo WorLd'.capitalize
# => "Hello world"
Our version only works on the first character of the String, preserving
the case of the rest of the String:
> 'heLLo WorLd'.sub(/\S/) { |m| Unicode.upcase(m) }
# => 'HeLLo WorLd'
Also handle unicode.
Diffstat (limited to 'spec/controllers/request_controller_spec.rb')
0 files changed, 0 insertions, 0 deletions