in reply to Cleaning Whitespace from Source Code

As others have pointed out, you can only strip leading and trailing whitespace, unless you want to risk messing up the code. Do a google search for the C-C++ Beautifier HOW-TO. It's very good. Indent and bcpp have options for specifying how much internal whitespace you want.

Basically for perl use perltidy, for c use indent, for c++ use bcpp, and htmltidy for html. What I have is a little perl script that strips all leading whitespace( and possibly leading line numbers followed by zero or 1 colon(or semi-colon typo) , then I run it thru the above mentioned beautifiers. And yes, occasionally I need to manually fix something, when the thing breaks on an odd line or 2.


I'm not really a human, but I play one on earth. flash japh
  • Comment on Re: Cleaning Whitespace from Source Code