Expresso 5-6

com.jcorporate.expresso.core.misc
Class Format

java.lang.Object
  extended bycom.jcorporate.expresso.core.misc.Format

public class Format
extends Object

Author:
Michael Nash

Constructor Summary
Format(String s)
          Formats a number in a printf format, like C
 
Method Summary
static double atof(String s)
          Converts a string of digits to an double
static int atoi(String s)
          Converts a string of digits (decimal, octal or hex) to an integer
static long atol(String s)
          Converts a string of digits (decimal, octal or hex) to a long integer
 String form(char c)
          Formats a character into a string (like sprintf in C)
 String form(double x)
          Formats a double into a string (like sprintf in C)
 String form(long x)
          Formats a long integer into a string (like sprintf in C)
 String form(String s)
          Formats a string into a larger string (like sprintf in C)
static void print(PrintStream s, String fmt, char x)
          prints a formatted number following printf conventions
static void print(PrintStream s, String fmt, double x)
          prints a formatted number following printf conventions
static void print(PrintStream s, String fmt, long x)
          prints a formatted number following printf conventions
static void print(PrintStream s, String fmt, String x)
          prints a formatted number following printf conventions
static void print(PrintWriter s, String fmt, double x)
          prints a formatted number following printf conventions
static void print(PrintWriter s, String fmt, String x)
          prints a formatted number following printf conventions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Format

public Format(String s)
Formats a number in a printf format, like C

Parameters:
s - the format string following printf format string The string has a prefix, a format code and a suffix. The prefix and suffix become part of the formatted output. The format code directs the formatting of the (single) parameter to be formatted. The code has the following structure
Method Detail

atof

public static double atof(String s)
Converts a string of digits to an double

Parameters:
s - a string
Returns:

atoi

public static int atoi(String s)
Converts a string of digits (decimal, octal or hex) to an integer

Parameters:
s - a string
Returns:
the numeric value of the prefix of s representing a base 10 integer

atol

public static long atol(String s)
Converts a string of digits (decimal, octal or hex) to a long integer

Parameters:
s - a string
Returns:
the numeric value of the prefix of s representing a base 10 integer

form

public String form(char c)
Formats a character into a string (like sprintf in C)

Parameters:
c - the value to format
Returns:
the formatted string

form

public String form(double x)
Formats a double into a string (like sprintf in C)

Parameters:
x - the number to format
Returns:
the formatted string

form

public String form(long x)
Formats a long integer into a string (like sprintf in C)

Parameters:
x - the number to format
Returns:
the formatted string

form

public String form(String s)
Formats a string into a larger string (like sprintf in C)

Parameters:
s - the value to format
Returns:
the formatted string

print

public static void print(PrintStream s,
                         String fmt,
                         char x)
prints a formatted number following printf conventions

Parameters:
s - a PrintStream
fmt - the format string
x - the character to

print

public static void print(PrintStream s,
                         String fmt,
                         double x)
prints a formatted number following printf conventions

Parameters:
s - a PrintStream
fmt - the format string
x - the double to print

print

public static void print(PrintStream s,
                         String fmt,
                         long x)
prints a formatted number following printf conventions

Parameters:
s - a PrintStream
fmt - the format string
x - the long to print

print

public static void print(PrintStream s,
                         String fmt,
                         String x)
prints a formatted number following printf conventions

Parameters:
s - a PrintStream, fmt the format string
fmt -
x - a string that represents the digits to print

print

public static void print(PrintWriter s,
                         String fmt,
                         double x)
prints a formatted number following printf conventions

Parameters:
s - a PrintStream
fmt - the format string
x - the double to print

print

public static void print(PrintWriter s,
                         String fmt,
                         String x)
prints a formatted number following printf conventions

Parameters:
s - a PrintStream, fmt the format string
fmt -
x - a string that represents the digits to print

Expresso 5-6

Please see www.jcorporate.com for information about new Expresso releases.