summaryrefslogtreecommitdiff
path: root/doc/string/upcase.rdoc
blob: ad859e89736687f2a5bc4c9cbb98d01ea0c57cec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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].