Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

String#upcase

str.upcase → new_str
str.upcase([options]) → new_str

Returns a copy of str with all lowercase letters replaced with their uppercase counterparts.

See String#downcase for meaning of options and use with different encodings.

Example
"hEllO".upcase   #=> "HELLO"

Ruby version changes

  1. 3.0
See also #upcase! #unpack1 #unpack #upto also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1