Looking for an easy way to align text

前端 未结 6 2053
悲哀的现实
悲哀的现实 2021-01-31 07:17

I have a common problem that I\'m looking for a solution to. I have lines of similar text I\'d like to somehow automatically insert text to align them vertically such that:

6条回答
  •  死守一世寂寞
    2021-01-31 08:14

    Notepad++ has a plugin that does this for you. It's called "Code alignment". It allows you to align text vertically based on characters of your choosing. You can install it via the Plugin Manager for notepad.

    Below is a simple usage scenario. You start off with the following code, then you align by "equals" which is a built-in shortcut/command for the plugin.

    Initial Code Sample, without alignment

    After that, you end up with the following below:

    Code after equals alignment

    You can also take it a step further and use the "align by..." command which allows you to specify any arbitrary alignment string. In the example below, I chose the "#" character in order to align my comments next to one another. This could just as easily have been a longer string, and not one of length 1.

    End result below:

    Final result after arbitrary code alignment string

提交回复
热议问题