puts "heLLo James!".downcase #=> "hello james!"
puts "hello James! I'm Demi".upcase #=> HELLO JAMES! I'M DEMI
puts "hello James! I'm Demi".capitalize #=> Hello james! i'm demi
If you want to replace the new string in the object itself without being returned, you can add !
after it.
string = "hello James!"
string.downcase!
puts string #=> "hello james!"
© 2024 OneMinuteCode. All rights reserved.