"string".upcase # => "STRING"
"STRING".downcase # => "string"
"String".swapcase # => "sTRING"
"string".capitalize # => "String"
These four methods do not modify the original receiver. For example,
str = "Hello"
str.upcase # => "HELLO"
puts str # => "Hello"
There are four similar methods that perform the same actions but modify original receiver.
"string".upcase! # => "STRING"
"STRING".downcase! # => "string"
"String".swapcase! # => "sTRING"
"string".capitalize! # => "String"
For example,
str = "Hello"
str.upcase! # => "HELLO"
puts str # => "HELLO"
Notes: