regex - Ruby: Delete space after every comma? -
What will be the ruby code to delete the white space after each comma in the string? I'm not sure why this works.
.gsub (/ [,] /, ',')
"hello, world" .gub (/, /, ',') [] is used to match any of the contained characters. You are changing each comma or space with a comma.
Comments
Post a Comment