日期:2019年1月21日
PHP将多个连续空格减少到一个空格
一个PHP函数,它将字符串中的多个连续空格减少到一个空格,因此像“”这样的东西减少为“”。
1 2 3 | function reduceMultipleSpacesToSingleSpace($ text){ return preg_replace('/ \ s + /',“”,$ text); } |
一个PHP函数,它将字符串中的多个连续空格减少到一个空格,因此像“”这样的东西减少为“”。
1 2 3 | function reduceMultipleSpacesToSingleSpace($ text){ return preg_replace('/ \ s + /',“”,$ text); } |