Put single quote marks around highlighted text (including multiple lines)
Very often i have copied a list of items i want to query in an IN() statement from the database, for example:
abc
def
ghi
jkl
and I want to format it like this:
'abc'
'def'
'ghi'
'jkl'
or better yet:
'abc'
, 'def'
, 'ghi'
, 'jkl'
Being able to highlight, right click, and select an option do do this, would be incredibly helpful.
-
Chris Jones commented
@Ragan
Amazing! Shared this with the team!
Thank you.
-
Ragan McGill commented
Hi Chris
There is a snippet available for this. If you highlight your list, press control and select 'Add quotes and commas' you should get the desired result - something I have found incredibly time saving in the past too :)
Here is a nice tip video on this which shows it in action - https://www.red-gate.com/products/sql-development/sql-prompt/resources/tip-11-quick-sql-prompt-actions-at-your-fingertips
Hope this helps and your idea suggestion is much appreciated.
Thanks
-
Benjamin Strautin commented
I've been using PowerShell for this sort of formatting; this code will get the clipboard contents, format it the way you want, and copy it back to the clipboard:
(gcb | %{"'$_'"}) -join "`n," | scb
The same code using full cmdlet names instead of aliases:
(Get-Clipboard | Foreach-Object {"'$_'"}) -join "`n," | Set-Clipboard