var oldString = "Test---NEWLINE------NEWLINE---This is another line.---NEWLINE---And another line.---NEWLINE------NEWLINE------NEWLINE---One more line.";
我只想要一个“--- NEWLINE ---”一次出现。如果有多个彼此相邻,我希望它们被删除。因此,新的字符串将是:删除特定的重复字符串(但留下一个)
var newString = "Test---NEWLINE---This is another line.---NEWLINE---And another line.---NEWLINE---One more line.";
让我们看看你先试了一下,努力吧。 –