In Ruby, you can easily convert a string to lowercase or uppercase using the downcase
and upcase
methods, respectively. Here's how you can do it with examples:
- Converting to lowercase using the
downcase
method:
ruby
original_string = "Hello, World!"
lowercase_string = original_string.downcase
puts "Original: #{original_string}"
puts "Lowercase: #{lowercase_string}"
Comments
Post a Comment