Reputation: 4572
How I can delete the first "#" character of a string?
"fooo#oooooo#bar"
"fooooooooo#bar" "fooo#oooooo#bar".delete_first("#") // Exist some method like this?
Upvotes: 5
Views: 3901
Reputation: 80065
sub (not gsub) does that:
gsub
"fooo#oooooo#bar".sub('#', '') #=> "fooooooooo#bar"
Upvotes: 22