Answers for "replace string character with $ 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 "replace string character with $ ruby"

Browse Popular Code Answers by Language