February 18, 2011

HOWTO: Remove linebreaks in VS.NET

This little trick helped me while working on a JsUnit test…thought I’d pass it on.

I was taking a long chunk of HTML in a unit test, pulled it into vs.net, formatted it so it was human readable, and then needed to ‘unformat’ it. Instead of manually deleting the new line characters, I did this:

1. Control-H to open the find & replace dialog

2. Put in the regular expression \n (newline)

3. Selected the ‘Use’ checkbox and Regular expressions from the dropdown

4. Clicked replace all

5. Postponed carpel tunnel surgery for a bit longer… J



adapted from: http://geekswithblogs.net/mnf/archive/2008/03/04/remove-empty-lines-in--text-using-visual-studio.aspx

1 comment:

Seoacer wong said...

Thanks for the good writeup. It actually used to be a enjoyment account it.http://www.seoacer.com/blog/