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

Popular posts from this blog

php - Creating canonical URLs with custom route-classes -

Mysql Local server hardware -

mysql - Formatting problem with PHP DateTime Difference when used as part of an equation -