| java.lang.Object com.jcorporate.expresso.core.misc.Format
Format | public class Format (Code) | | author: Michael Nash |
Constructor Summary | |
public | Format(String s) Formats a number in a printf format, like C
Parameters: s - the format string following printf format stringThe string has a prefix, a format code and a suffix. |
Method Summary | |
public static double | atof(String s) | public static int | atoi(String s) | public static long | atol(String s) | public String | form(char c) | public String | form(double x) | public String | form(long x) | public String | form(String s) | public static void | print(PrintStream s, String fmt, char x) | public static void | print(PrintStream s, String fmt, double x) | public static void | print(PrintStream s, String fmt, long x) | public static void | print(PrintStream s, String fmt, String x) | public static void | print(PrintWriter s, String fmt, double x) | public static void | print(PrintWriter s, String fmt, String x) |
Format | public Format(String s)(Code) | | Formats a number in a printf format, like C
Parameters: s - the format string following printf format stringThe string has a prefix, a format code and a suffix. The prefix and suffixbecome part of the formatted output. The format code directs theformatting of the (single) parameter to be formatted. The code has thefollowing structure- a % (required)
- a modifier (optional)
- +
- forces display of + for positive numbers
- 0
- show leading zeroes
- -
- align left in the field
- space
- prepend a space in front of positive numbers
- #
- use "alternate" format. Add 0 or 0x for octal or hexadecimal numbers.Don't suppress trailing zeroes in general floating point format.
- an integer denoting field width (optional)
- a period followed by an integer denoting precision (optional)
- a format descriptor (required)
- f
- floating point number in fixed format
- e, E
- floating point number in exponential notation (scientific format).The E format results in an uppercase E for the exponent (1.14130E+003), the eformat in a lowercase e.
- g, G
- floating point number in general format (fixed format for smallnumbers, exponential format for large numbers). Trailing zeroes are suppressed.The G format results in an uppercase E for the exponent (if any), the g formatin a lowercase e.
- d, i
- integer in decimal
- x
- integer in hexadecimal
- o
- integer in octal
- s
- string
- c
- character
|
atof | public static double atof(String s)(Code) | | Converts a string of digits to an double
Parameters: s - a string |
atoi | public static int atoi(String s)(Code) | | Converts a string of digits (decimal, octal or hex) to an integer
Parameters: s - a string the numeric value of the prefix of s representing abase 10 integer |
atol | public static long atol(String s)(Code) | | Converts a string of digits (decimal, octal or hex) to a long integer
Parameters: s - a string the numeric value of the prefix of s representing abase 10 integer |
form | public String form(char c)(Code) | | Formats a character into a string (like sprintf in C)
Parameters: c - the value to format the formatted string |
form | public String form(double x)(Code) | | Formats a double into a string (like sprintf in C)
Parameters: x - the number to format the formatted string |
form | public String form(long x)(Code) | | Formats a long integer into a string (like sprintf in C)
Parameters: x - the number to format the formatted string |
form | public String form(String s)(Code) | | Formats a string into a larger string (like sprintf in C)
Parameters: s - the value to format the formatted string |
print | public static void print(PrintStream s, String fmt, char x)(Code) | | prints a formatted number following printf conventions
Parameters: s - a PrintStream Parameters: fmt - the format string Parameters: x - the character to |
print | public static void print(PrintStream s, String fmt, double x)(Code) | | prints a formatted number following printf conventions
Parameters: s - a PrintStream Parameters: fmt - the format string Parameters: x - the double to print |
print | public static void print(PrintStream s, String fmt, long x)(Code) | | prints a formatted number following printf conventions
Parameters: s - a PrintStream Parameters: fmt - the format string Parameters: x - the long to print |
print | public static void print(PrintStream s, String fmt, String x)(Code) | | prints a formatted number following printf conventions
Parameters: s - a PrintStream, fmt the format string Parameters: fmt - Parameters: x - a string that represents the digits to print |
print | public static void print(PrintWriter s, String fmt, double x)(Code) | | prints a formatted number following printf conventions
Parameters: s - a PrintStream Parameters: fmt - the format string Parameters: x - the double to print |
print | public static void print(PrintWriter s, String fmt, String x)(Code) | | prints a formatted number following printf conventions
Parameters: s - a PrintStream, fmt the format string Parameters: fmt - Parameters: x - a string that represents the digits to print |
|
|