How can I remove extra commas and add commas for example using PHP
user submitted data
stack,,,,,,,,,,,,,,overflow
should output.
stack, 开发者_C百科overflow
$out = preg_replace("/,+/",", ",$in);
preg_replace('/[,]+/', ',', $string); should do it... though depending on the nature of the input you may need a more complex expression.
$str = preg_replace('/,+/' , ',' , $str);
This will replace each sequence of one or more commas with one comma.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论