Sublime text: Merge multiple adjacent white spaces into one

前端 未结 2 489
我在风中等你
我在风中等你 2021-01-21 09:38

How to do this in sublime text

\"aaa     bbb ccc    ffffdffffdd   \"

should get converted to

\"aaa bbb ccc ffffdffffdd \"
2条回答
  •  萌比男神i
    2021-01-21 10:09

    This can also be done with a regex search and replace. First, select the text you want to alter. Next, click on Find -> Replace.... Make sure the Regex and In selection buttons are selected. To visualize what you're going to replace, you can also select the Highlight matches button as well. In the Find What field, enter (\s){2,}, and in the Replace With field, just enter a space. Click Replace All, and all instances of two or more whitespace characters will be replaced with a single space.

提交回复
热议问题