I have a list of data to which I need to put a \'
symbol at the start of the line and at the end of the line. So the original data looks like this:
You could edit and replace with a regex:
Find (Ctrl+F):
^(.+)$
Replace:
'$1'
This regex finds any content on a line and wraps it inside quotes. The $1
refers to whatever is matched inside the parentheses in the regex. In this case, it's "one or more characters" i.e. everything on the line. Be sure to tick the regex icon.
If every line may or may not have a space before the content, and you want every line to have a space, try this:
Find:
^ ?(.+)$
Replace (notice the space before the first quote):
'$1'
Here is an easy way to do this:
Ctrl+A to select all or select your desired text.
Shift+Alt+I to put a cursor at the end of each line.
Type your ' (or whatever you want at the end).
Home will move all your cursors to the beginning of the lines.
Type your ' (or whatever you want at the beginning of all the lines).
You can use Find and Replace.
Besides, paste to Excel and using a function to add character '
.
The first thing that came to my mind - replace abcde
with 'abcde'
line by using option Find and Replace
option. I'm pretty sure Visual Studio Code has something similar to that.
You can use the Alt + Shift shortcut.
First press Alt + Shift then click the mouse button on the first line.
Go to the last line, and then do the same.
This will mark all the parts of one side. Whatever you type will be reflected in the marked spaces.
Do the same on the other side too.
Use Toggle Multi curosr Modified
from action pane.
Select the cursor points with ctrl
+ <Mouse click>
, you can modify everything simultaneously.
This will require lots of manual efforts if lines are more