开发者

Ruby: Delete space after every comma?

What would开发者_开发百科 be the ruby code to delete whitespace after every comma in a string? I'm not sure why this didn't work..

.gsub(/[, ]/, ',') 


"hello, world".gsub(/, /, ',')

The [] are used to match any of the contained characters. You are replacing every comma or space with a comma.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜