Sunday 15 March 2015

1] Remove empty lines and spaces

A

B

C

D

E

Required result:
A
B
C
D
E

Soln 1:




Soln 2:
To get rid of leading space(s) and all empty lines (even if the empty line contains spaces or tabs)
1. Go to Search -> Replace
2. Select "Regular expression" under Search mode.
3. Use ^\s* for "Find what" and leave "Replace with" blank.
4. Click Replace all.

Regex explanation:
1) ^ means beginning of the line.
2) \s* means any number (even 0) of whitespace characters. Whitespace characters include tab, space, newline, and carriage return.


2] Join 2 lines
A
B
C
D

Required result:
A B C D

Soln:
Shortcut: Select All --> Ctrl +J




3] Convert to LOWER or UPPER case

Select the text for which you want to change the case.



4] Replace new line or “\n” with comma
Something
something else
blah

Required result:
Something,something else,blah

Soln:
In the notepad++ search & replace dialog (Ctrl-H), go into "Extended" mode.
From there, replacing \r\n with ,(comma) should do it.


5] Select particular text
Press Alt key then select the required text.




6] Append/Prepend text

Append:
abc
cde
fgh
xyz

Required result:
abc"+
cde"+
fgh"+
xyz"+

Note: $ means end of the line.



PrePend:
abc
cde
fgh
xyz

Required result:
"abc
"cde
"fgh
"xyz

Note: ^ means beginning of the line.