Home > Net >  How to substitute substring with dynamic number of spaces
How to substitute substring with dynamic number of spaces

Time:09-25

I would like to use Notepad to substitute the decimal digits of a column of numbers with an equivalent amount of white spaces.

For example, this input (vertical bars are there on purpose)

|    1.23|
|  45.678|
|901.2345|

would become

|    1   |
|  45    |
|901     |

Basically, the dot and decimal digits have been substituted with a dynamic number of white spaces: 2 1 spaces for the first row, 3 1 for the second, 4 1 for the third.

I've looked at a few different posts like enter image description here

Screenshot (after):

enter image description here

CodePudding user response:

You can run a python script within the PythonScript plugin.

The following will work for any number of digits after the dot.

If it is not yet installed, follow this enter image description here

Screenshot (after):

enter image description here

  • Related