|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--sdsu.FormatString
This string formatting class emulates some of the functionality of the the standard C library sprintf() function. Since Java doesn't allow for a variable number of arguments of anonymous types, the formatting has been split up into several format member functions with different. arguments.
Some example uses of this class:
sdsu.FormatString.format("'%5d'", 42) gives ' 42' sdsu.FormatString.format("'%-10s'", "hi") gives 'hi ' sdsu.FormatString.format("'%s: 0x%08x'", "address", 8592837) gives 'address: 0831dc5' etc.The floating point to ASCII conversion is very incomplete.
Since all the format member functions are static, you will never have to create a FormatString object.
Method Summary | |
static java.lang.String |
format(java.lang.String fmt,
char c)
Produce a formatted character depending on the format pattern. |
static java.lang.String |
format(java.lang.String fmt,
double d)
Produce a formatted floating point number depending on the format pattern. |
static java.lang.String |
format(java.lang.String fmt,
long n)
Produce a formatted integer depending on the format pattern. |
static java.lang.String |
format(java.lang.String fmt,
long n1,
long n2)
Produce a string depending on the format pattern. |
static java.lang.String |
format(java.lang.String fmt,
long n1,
long n2,
long n3)
Produce a string depending on the format pattern. |
static java.lang.String |
format(java.lang.String fmt,
long n1,
java.lang.String s2)
Produce a string depending on the format pattern. |
static java.lang.String |
format(java.lang.String fmt,
java.lang.String s)
Produce a formatted string depending on the format pattern. |
static java.lang.String |
format(java.lang.String fmt,
java.lang.String s1,
long n2)
Produce a string depending on the format pattern. |
static java.lang.String |
format(java.lang.String fmt,
java.lang.String s1,
java.lang.String s2)
Produce a string depending on the format pattern. |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Method Detail |
public static java.lang.String format(java.lang.String fmt, long n)
fmt
- the format stringn
- the integer number to be formattedpublic static java.lang.String format(java.lang.String fmt, java.lang.String s)
fmt
- the format strings
- the string to be formattedpublic static java.lang.String format(java.lang.String fmt, char c)
fmt
- the format stringc
- the character to be formattedpublic static java.lang.String format(java.lang.String fmt, double d)
fmt
- the format stringd
- the floating point number to be formattedpublic static java.lang.String format(java.lang.String fmt, long n1, long n2)
fmt
- the format stringn1
- the first integer to be formattedn2
- the second integer to be formattedpublic static java.lang.String format(java.lang.String fmt, java.lang.String s1, long n2)
fmt
- the format strings1
- the string to be formattedn2
- the integer to be formattedpublic static java.lang.String format(java.lang.String fmt, long n1, java.lang.String s2)
fmt
- the format stringn1
- the integer to be formatteds2
- the string to be formattedpublic static java.lang.String format(java.lang.String fmt, java.lang.String s1, java.lang.String s2)
fmt
- the format strings1
- the first string to be formatteds2
- the second string to be formattedpublic static java.lang.String format(java.lang.String fmt, long n1, long n2, long n3)
fmt
- the format stringn1
- the first integer to be formattedn2
- the second integer to be formattedn3
- the third integer to be formatted
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |