Home >Development Tools >notepad >Tip sharing: How to add content at the beginning and end of each line in Notepad

Tip sharing: How to add content at the beginning and end of each line in Notepad

藏色散人
藏色散人forward
2021-07-19 15:17:115971browse

1. notepadIntroduction

In the process of programmer development, a good The tool is notepad, which is an enhancement of notepad. It has enhanced many functions, including the column block editing mode that programmers like, and supports many plug-ins, such as json formatting and markdown syntax.
One scenario is this,
Tip sharing: How to add content at the beginning and end of each line in Notepad
For example, the title bar of the uploaded salary slip is the above content. Therefore, when entering the database, we need to change all these contents into String, but it is very troublesome to operate one by one. How can I use notepad to quickly add the required characters at the beginning and end of the line?

2. Operation steps

2.1 Extract the content of the salary slip header row in Excel

Transpose the content of the salary row header row into column form, as shown in the previous figure .

2.2 Use column block editing mode to add "" to the beginning of the line

First place the cursor before the serial number, then click Edit, select column block editing, or after placing the cursor before the serial number , use the shortcut key Alt C to quickly open the column block editing dialog box.
Tip sharing: How to add content at the beginning and end of each line in Notepad
The results are as follows:
Tip sharing: How to add content at the beginning and end of each line in Notepad

2.3 Add ",

## at the end of the line #Use the notepad replacement function to add "," at the end of each line to form the required string content


Tip sharing: How to add content at the beginning and end of each line in Notepad After clicking OK, perform all replacements, the effect is as follows:

Tip sharing: How to add content at the beginning and end of each line in Notepad

2.4 Remove the newline character from each line

Since there may be many lines, the number of lines of code may increase dramatically when working, so you can use wildcard matching to delete the newline character at the end of each line. , the simplified code operation is as follows:


Tip sharing: How to add content at the beginning and end of each line in Notepad Note: the line break may be "\n" (mostly this) or "\r" or "\r\n"
The effect is as follows:

Tip sharing: How to add content at the beginning and end of each line in Notepad

3. Summary

Using notepad for batch operations and column block editing are very good features, which can improve the efficiency of programmers and reduce boring copy actions. It is worth accumulating.

The above is the detailed content of Tip sharing: How to add content at the beginning and end of each line in Notepad. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete