Please note, this is a STATIC archive of website www.w3resource.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
w3resource

Ruby String Exercises: Lower case, upper case and capitalizes all the words of a given string

Ruby String: Exercise-3 with Solution

Write a Ruby program to lower case, upper case and capitalizes all the words of a given string.

Ruby String Exercises: Lower case, upper case and capitalizes all the words of a given string

Ruby Code:

print("ruby exercises!".upcase)
print("\n","Ruby Exercises!".downcase)
print("\n","ruby exercises!".capitalize)

Output:

RUBY EXERCISES!
ruby exercises!
Ruby exercises!

Flowchart:

Flowchart: Lower case, upper case and capitalizes all the words of a given string

Ruby Code Editor:

Contribute your code and comments through Disqus.

Previous: Write a Ruby program to insert a string of length 2 to an another string where the first string will be in the middle of the second string.
Next: Write a Ruby program to check whether a string contains a substring.

What is the difficulty level of this exercise?