Skip to content

Instantly share code, notes, and snippets.

@douglasmartins7
Created July 4, 2017 22:19
Show Gist options
  • Save douglasmartins7/69622e20ae68acdd63b76962bbb294b6 to your computer and use it in GitHub Desktop.
Save douglasmartins7/69622e20ae68acdd63b76962bbb294b6 to your computer and use it in GitHub Desktop.
print "Type the text with s:"
user_input = gets.chomp #gets method the object string that capture text user, chomp clean the line
user_input.downcase! #downcase method caixa baixa letter
if user_input.include? "s" #include if contains letter s return true
user_input.gsub!(/s/, "th") #gsub troca o s pelo th
else
print "Nothing to do here!"
end
puts "Your string is: #{user_input}" # insert string and variable with type users
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment