0
0
Rubyprogramming~15 mins

String methods (upcase, downcase, strip) in Ruby - Mini Project: Build & Apply

Choose your learning style9 modes available
Using String Methods: upcase, downcase, strip
📖 Scenario: You work at a small online store. Customers enter their names and messages, but sometimes they add extra spaces or use different letter cases. You want to clean up their input before saving it.
🎯 Goal: You will write a Ruby program that takes a customer's name and message, removes extra spaces, and changes the text to uppercase or lowercase as needed.
📋 What You'll Learn
Create variables with exact names and values as instructed
Use the Ruby string methods upcase, downcase, and strip
Print the final cleaned and formatted strings exactly as shown
💡 Why This Matters
🌍 Real World
Cleaning and formatting user input is important in many apps to keep data consistent and easy to read.
💼 Career
Knowing how to manipulate strings is a basic skill for programming jobs, especially in web development and data processing.
Progress0 / 4 steps
1
Create the initial strings
Create two string variables: customer_name with the value " Alice " and customer_message with the value "Hello, I LOVE your store! ".
Ruby
Need a hint?

Use double quotes for the strings and include the spaces exactly as shown.

2
Add variables for cleaned strings
Create two new variables: clean_name by removing spaces from customer_name using strip, and message_lower by converting customer_message to lowercase using downcase.
Ruby
Need a hint?

Use .strip to remove spaces and .downcase to make all letters lowercase.

3
Create an uppercase message
Create a variable message_upper by converting customer_message to uppercase using upcase.
Ruby
Need a hint?

Use .upcase to make all letters uppercase.

4
Print the cleaned and formatted strings
Print the variables clean_name, message_lower, and message_upper each on its own line, in that order.
Ruby
Need a hint?

Use puts to print each variable on its own line.