Regular Expressions in Java

Package com.stevesoft.pat version 1.5.3

Home
Articles/Links
Mugs, T-shirts Comments/Raves
New in 1.5.3
A Game
An Online Test
Questions

Copyright/License
Download Free

 If you need a non-LGPL version
You Can Buy!

Online help...
Quick Start
Tutorial Part 1
Tutorial Part 2
Tutorial Part 3
Tutorial Part 4
Tutorial Part 5
Tutorial Part 6
Examples
Support
FAQ
Documentation

Useful apps...
Java Beautifier
Code Colorizer
GUI Grep
Swing Grep

Other stuff...
Phreida
xmlser

JavaBeautifier 1.0: Command line usage


  java com.stevesoft.jbeaut.JavaBeautifier [-tab=number] 
       [-braces=NextLine|EndOfLine] file(s) 

The JavaBeautifier will beautify the files in place (a copy of the original will be saved to filename.bak).

Code that looks like this:

if(a)
if(b)
c;
else(d)
e;
if(a) {
while(b) {
c; /*
     Here is a table:
        +------+------+
        | col1 | col2 |
        +------+------+
        | vol1 | vol2 |
        +------+------+
     */
}
}
Will be transformed to look like this:
if(a)
    if(b)
        c;
    else(d)
        e;
if(a) {
    while(b) {
        c; /*
             Here is a table:
                +------+------+
                | col1 | col2 |
                +------+------+
                | vol1 | vol2 |
                +------+------+
             */
    }
}

The text is indented four additional spaces after each "{" and four fewer spaces after each "}". Note that while the multi-line comment in the above pseudo code is indented, it's overall structure is returned. The + is still aligned under the second "e" in "Here".

Although this is not apparent in the illustration, note that all tabs are removed from the source file by the beautification procedure and replaced by spaces.

If the -tab=number option is supplied, then the default indent will be changed from four to number spaces.

By default, the JavaBeautifier does not add any newlines to your code. If this is not the behavior you desire, you can ask the JavaBeautifier to insert carriage returns after curly braces.

If the -braces=EndOfLine option is supplied, then code of the following form:

if(a) { b; } else { c; }
would be transformed into the following:
if(a) {
  b;
} else {
  c;
}
If the -braces=EndOfLine option is supplied, then code of the following form:
if(a) { b; } else { c; }
would be transformed into the following:
if(a)
{
  b;
}
else
{
  c;
}