mirror of
https://github.com/ruby/ruby.git
synced 2026-01-26 20:19:19 +00:00
28 lines
868 B
Plaintext
28 lines
868 B
Plaintext
Returns a new string containing the upcased characters in +self+:
|
|
|
|
'hello'.upcase # => "HELLO"
|
|
'straße'.upcase # => "STRASSE"
|
|
'привет'.upcase # => "ПРИВЕТ"
|
|
'RubyGems.org'.upcase # => "RUBYGEMS.ORG"
|
|
|
|
The sizes of +self+ and the upcased result may differ:
|
|
|
|
s = 'Straße'
|
|
s.size # => 6
|
|
s.upcase # => "STRASSE"
|
|
s.upcase.size # => 7
|
|
|
|
Some characters (and some character sets) do not have upcase and downcase versions;
|
|
see {Case Mapping}[rdoc-ref:case_mapping.rdoc]:
|
|
|
|
s = '1, 2, 3, ...'
|
|
s.upcase == s # => true
|
|
s = 'こんにちは'
|
|
s.upcase == s # => true
|
|
|
|
The casing is affected by the given +mapping+,
|
|
which may be +:ascii+, +:fold+, or +:turkic+;
|
|
see {Case Mappings}[rdoc-ref:case_mapping.rdoc@Case+Mappings].
|
|
|
|
Related: see {Converting to New String}[rdoc-ref:String@Converting+to+New+String].
|