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

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

memcached - Django cache performance -

java : convert string value to int -