Flags for regex : Regex « Utility Classes « SCJP






"-"         Left justify this argument

"+"         Include a sign (+ or -) with this argument

"0"         Pad this argument with zeroes

","         Use locale-specific grouping separators (i.e., the comma in 123,456)

"("         Enclose negative numbers in parentheses

width       This value indicates the minimum number of characters to print. 

precision   Formatting a floating-point number, 
            precision indicates the number of digits to print after the decimal point.

conversion  The type of argument you'll be formatting. You'll need to know:

            b    boolean
            c    char
            d    integer
            f    floating point
            s    string


public class MainClass {
  public static void main(String[] argv) {
    int i1 = -123;
    int i2 = 12345;
    System.out.printf(">%1$(7d< \n", i1);
    System.out.printf(">%0,7d< \n", i2);
    System.out.format(">%+-7d< \n", i2);
    System.out.printf(">%2$b + %1$5d< \n", i1, false);

  }
}
>  (123)< 
>012,345< 
>+12345 < 
>false +  -123<








8.24.Regex
8.24.1.. Matches any character
8.24.2.\d Matches any digit ("0" - "9")
8.24.3.\s Matches any whitespace character, such as space, tab, or newline
8.24.4.\w Matches any letter ("a" - "z" or "A" - "Z") or digit
8.24.5.Using escape sequence in regular expression.
8.24.6.* Matches zero or more occurrences of the preceding pattern
8.24.7.+ Matches one or more occurrences of the preceding pattern
8.24.8.? Matches zero or one occurrences of the preceding pattern
8.24.9.Flags for regex
8.24.10.A small program that uses a console to support testing another class
8.24.11.Tokenizing with String.split()