This is a neat trick I have learnt recently. When dealing with large lists of information, we, as developers, sometimes need to copy them, then add commas manually.
Say, for instance, you have a list of numbers, and you have constructed the query to resemble the query below:
SELECT StudentID FROM Students
WHERE StudentID
IN (1
2
3
4
5
6
7
8
9
)
Now you need to add the commas manually. What happens when you have a larger list? There will be lots of freudian slips and finger-faults.
Solution: Multi Edit Mode
Click and hold the left mouse button to the left of the last item in the list. (Click left the number 9, in the above example).
- Keep holding down the button
- Press and hold the Alt button on the keyboard
- Drag upwards (to the number 2 in the example above)
- Release both the Alt button and the left mouse button
- Notice that there is a fine blue line where you have dragged Press
Notice that the whole list gets populated with commas next to them, as shown next:
SELECT StudentID FROM Students
WHERE StudentID
IN (1
, 2
, 3
, 4
, 5
, 6
, 7
, 8
, 9
)
You can continue typing more, but when done, press Escape to exit Multi Edit mode.
Visit the DevX Tip Bank