In my program I want to add a method for double letters in a string. My question is there a public method to that? For example:
'The'→TThhee'
Here’s what I have:
puts "Please enter text: "
input = gets
letters = input.chomp.to_s
puts "You entered: " + letters + "."
list_letters = letters.split(//)
list = list_letters.join(". ")* 2.to_i
puts "Your text is made up of the letters: " + list + "."
or even shorter:
A bit more comfortable:
Your example code makes something different. Perhaps you wanted to do something like:
or