Answers for "replace ruby string characters"

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 "replace ruby string characters"

Browse Popular Code Answers by Language