How do I take a string and convert it to lower or upper case in Ruby?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Ruby has a few methods for changing the case of strings. To convert to lowercase, use
downcase:Similarly,
upcasecapitalizes every letter andcapitalizecapitalizes the first letter of the string but lowercases the rest:If you want to modify a string in place, you can add an exclamation point to any of those methods:
Refer to the documentation for String for more information.