Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个带有句子的数组。有时单词被制表符分隔,有时一个,有时不止一个。
我想我想要的很简单。我想将单词之间的制表符数量更改为 1,以将所有单词除以一个以上的制表符。
Example, I want to change this: \t\t This \t\t\t\t\t is \t\t a\t test. into this: \t This \t is \t a \t test.
提前致谢!
$string = preg_replace("/\t+/", "\t", $string);