Answers for "switch one word for another ruby"

1

ruby replace certain character

# Ruby language
str_old = "first-name last-name"
str_old.sub("-", "_") 		# Replace first "-" with "_"
str_old.gsub("-", "_") 		# Replace all "-" with "_"
Posted by: Guest on May-21-2020

Code answers related to "switch one word for another ruby"

Browse Popular Code Answers by Language