Pages

Monday, June 13, 2011

Steps to remove empty lines using Visual Studio i.e format the coding

Steps to remove empty lines using Visual Studio i.e format the coding in .cs or .vb file
Start Visual Studio and follow these steps.
1.Click Ctrl-H (quick replace)
2. Tick "Use Regular Expressions"
3. In Find specify ^$\n

4. In Replace box delete everything.
5 Click "Replace All"
All empty lines will be deleted.



Regular expression for empty line consist of  
Beginning of line ^
End of line $
Line break \n


A regex to remove blank lines that are/aren't *really* blank (i.e. they do/don't have spaces):  
^:b*$\n

No comments:

Post a Comment