Is there a way to add a space after commas in a string only if it doesn\'t exist.
Example:
word word,word,word,
Would end up as
Just use a regular expression to replace all instances of "," not followed by a space with ", ".
","
", "
str = "word word,word,word," str = str.gsub(/,([^ ])/, ', \1') # "word word, word, word,"