📜  ruby 替换某些字符 - Ruby 代码示例

📅  最后修改于: 2022-03-11 15:04:49.206000             🧑  作者: Mango

代码示例1
# Ruby language
str_old = "first-name last-name"
str_old.sub("-", "_")         # Replace first "-" with "_"
str_old.gsub("-", "_")         # Replace all "-" with "_"