Check out example codes for "ruby replace certain character". It will help you in understanding the concepts better.
Code Example 1
# Ruby language
str_old = "first-name last-name"
str_old.sub("-", "_") # Replace first "-" with "_"
str_old.gsub("-", "_") # Replace all "-" with "_"
Learn ReactJs, React Native from akashmittal.com