Trying to replace all white space with a single space

后端 未结 3 932
感动是毒
感动是毒 2021-01-11 11:30

Any ideas?

My program is a file validation utility and I have to read in a format file then parse out each line by a single space. But obviously, the person who wr

3条回答
  •  没有蜡笔的小新
    2021-01-11 12:00

    This is a duplicate of this question

    however the answer is this (credit to Daok)

    Regex regex = new Regex(@"[ ]{2,}");     
    tempo = regex.Replace(tempo, @" ");
    

提交回复
热议问题