如何删除字符串的第一个“#”字符?
例子:
"fooo#oooooo#bar"
预期结果:
"fooooooooo#bar"
"fooo#oooooo#bar".delete_first("#") // Exist some method like this?
如何删除字符串的第一个“#”字符?
"fooo#oooooo#bar"
"fooooooooo#bar"
"fooo#oooooo#bar".delete_first("#") // Exist some method like this?
sub (not gsub
) 这样做:
"fooo#oooooo#bar".sub('#', '') #=> "fooooooooo#bar"