Search⌘ K
AI Features

Exercise 5: Remove Characters from a String

Explore how to manipulate strings in Ruby by removing specific characters using built-in methods. This lesson helps you understand string operations, improve code simplicity, and apply string manipulation techniques effectively.

We'll cover the following...

Problem statement

Skim through the string documentation in the Ruby documentation, and look for a method that removes characters from a string. Using that method, try to delete the input characters from the input string in the exercise below.

Example

input_string = "Ruby is fun"
input_characters = "u"
result = "Rby is fn"

Try it yourself

Ruby
def remove_chars(input_string, input_characters)
result = ""
# Start your code here
return result
end