jodd.format
Class Format

java.lang.Object
  extended byjodd.format.Format

public class Format
extends java.lang.Object

Fast, simple, and yet useful formattings.


Constructor Summary
Format(java.lang.String s)
          Formats a number in a printf format, like C
 
Method Summary
static double atof(java.lang.String s)
          Converts a string of digits to an double
static int atoi(java.lang.String s)
          Converts a string of digits (decimal, octal or hex) to an integer
static long atol(java.lang.String s)
          Converts a string of digits (decimal, octal or hex) to a long integer
static java.lang.String convert(long x, int n, java.lang.String d)
          Converts number to string
 java.lang.String form(char c)
          Formats a character into a string (like sprintf in C)
 java.lang.String form(java.lang.Character c)
           
 java.lang.String form(double x)
          Formats a double into a string (like sprintf in C)
 java.lang.String form(java.lang.Double x)
           
 java.lang.String form(java.lang.Float x)
           
 java.lang.String form(int x)
          Formats an integer into a string (like sprintf in C)
 java.lang.String form(java.lang.Integer x)
           
 java.lang.String form(long x)
          Formats a long integer into a string (like sprintf in C)
 java.lang.String form(java.lang.Long x)
           
 java.lang.String form(java.lang.String s)
          Formats a string into a larger string (like sprintf in C)
static java.lang.String sprintf(java.lang.String fmt, char x)
          prints a formatted number following printf conventions
static java.lang.String sprintf(java.lang.String fmt, java.lang.Character x)
           
static java.lang.String sprintf(java.lang.String s, java.lang.Character[] params)
           
static java.lang.String sprintf(java.lang.String fmt, double x)
          prints a formatted number following printf conventions
static java.lang.String sprintf(java.lang.String fmt, java.lang.Double x)
           
static java.lang.String sprintf(java.lang.String s, java.lang.Double[] params)
           
static java.lang.String sprintf(java.lang.String fmt, java.lang.Float x)
           
static java.lang.String sprintf(java.lang.String s, java.lang.Float[] params)
           
static java.lang.String sprintf(java.lang.String fmt, int x)
          prints a formatted number following printf conventions
static java.lang.String sprintf(java.lang.String s, int[] params)
           
static java.lang.String sprintf(java.lang.String fmt, java.lang.Integer x)
           
static java.lang.String sprintf(java.lang.String s, java.lang.Integer[] params)
           
static java.lang.String sprintf(java.lang.String fmt, long x)
          prints a formatted number following printf conventions
static java.lang.String sprintf(java.lang.String fmt, java.lang.Long x)
           
static java.lang.String sprintf(java.lang.String s, java.lang.Long[] params)
           
static java.lang.String sprintf(java.lang.String s, java.lang.Object[] params)
          Sprintf multiple strings.
static java.lang.String sprintf(java.lang.String fmt, java.lang.String x)
          prints a formatted number following printf conventions
static java.lang.String sprintf(java.lang.String s, java.lang.String[] params)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Format

public Format(java.lang.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

form

public java.lang.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 java.lang.String form(java.lang.Character c)

form

public java.lang.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 java.lang.String form(java.lang.Double x)

form

public java.lang.String form(java.lang.Float x)

form

public java.lang.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 java.lang.String form(java.lang.Long x)

form

public java.lang.String form(int x)
Formats an integer into a string (like sprintf in C)

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

form

public java.lang.String form(java.lang.Integer x)

form

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

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

atof

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

Parameters:
s - a string
Returns:
double converted from String

atoi

public static int atoi(java.lang.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(java.lang.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

convert

public static java.lang.String convert(long x,
                                       int n,
                                       java.lang.String d)
Converts number to string

Parameters:
x - value to convert
n - conversion base
d - string with characters for conversion.
Returns:
converted number as string

sprintf

public static java.lang.String sprintf(java.lang.String fmt,
                                       char x)
prints a formatted number following printf conventions

Parameters:
fmt - the format string
x - the character to
Returns:
formated string

sprintf

public static java.lang.String sprintf(java.lang.String fmt,
                                       java.lang.Character x)

sprintf

public static java.lang.String sprintf(java.lang.String fmt,
                                       double x)
prints a formatted number following printf conventions

Parameters:
fmt - the format string
x - the double to print
Returns:
formated string

sprintf

public static java.lang.String sprintf(java.lang.String fmt,
                                       java.lang.Double x)

sprintf

public static java.lang.String sprintf(java.lang.String fmt,
                                       java.lang.Float x)

sprintf

public static java.lang.String sprintf(java.lang.String fmt,
                                       long x)
prints a formatted number following printf conventions

Parameters:
fmt - the format string
x - the long to print
Returns:
formated string

sprintf

public static java.lang.String sprintf(java.lang.String fmt,
                                       java.lang.Long x)

sprintf

public static java.lang.String sprintf(java.lang.String fmt,
                                       int x)
prints a formatted number following printf conventions

Parameters:
fmt - the format string
x - the int to print
Returns:
formated string

sprintf

public static java.lang.String sprintf(java.lang.String fmt,
                                       java.lang.Integer x)

sprintf

public static java.lang.String sprintf(java.lang.String fmt,
                                       java.lang.String x)
prints a formatted number following printf conventions

Parameters:
fmt -
x - a string that represents the digits to print

sprintf

public static java.lang.String sprintf(java.lang.String s,
                                       java.lang.Object[] params)
Sprintf multiple strings.

Parameters:
s -
params -
Returns:
formated string

sprintf

public static java.lang.String sprintf(java.lang.String s,
                                       java.lang.String[] params)

sprintf

public static java.lang.String sprintf(java.lang.String s,
                                       java.lang.Integer[] params)

sprintf

public static java.lang.String sprintf(java.lang.String s,
                                       java.lang.Long[] params)

sprintf

public static java.lang.String sprintf(java.lang.String s,
                                       java.lang.Double[] params)

sprintf

public static java.lang.String sprintf(java.lang.String s,
                                       java.lang.Float[] params)

sprintf

public static java.lang.String sprintf(java.lang.String s,
                                       java.lang.Character[] params)

sprintf

public static java.lang.String sprintf(java.lang.String s,
                                       int[] params)


Jodd v0.24.5 Javadoc