| java.lang.Object tcl.lang.FormatCmd
FormatCmd | class FormatCmd implements Command(Code) | | This class implements the built-in "format" command in Tcl.
|
Method Summary | |
public void | cmdProc(Interp interp, TclObject argv) This procedure is invoked to process the "format" Tcl command.
See the user documentation for details on what it does.
The first argument to the cmdProc is the formatString. | static String | toString(double dblValue, int precision, int base) |
cmdProc | public void cmdProc(Interp interp, TclObject argv) throws TclException(Code) | | This procedure is invoked to process the "format" Tcl command.
See the user documentation for details on what it does.
The first argument to the cmdProc is the formatString. The cmdProc
simply copies all the chars into the sbuf until a '%' is found. At
this point the cmdProc parces the formatString and determines the
format parameters. The parcing of the formatString can be broken into
six possible phases:
Phase 0 - Simply Print: If the next char is %
Phase 1 - XPG3 Position Specifier: If the format [1-n]$ is used
Phase 2 - A Set of Flags: One or more of the following + -
[space] 0 #
Phase 3 - A Minimun Field Width Either [integer] or *
Phase 4 - A Precision If the format .[integer] or .*
Phase 5 - A Length Modifier If h is present
Phase 6 - A Conversion Character If one of the following is used
d u i o x X c s f E g G
Any phase can skip ahead one or more phases, but are not allowed
to move back to previous phases. Once the parameters are determined
the cmdProc calls one of three private methods that returns a fully
formatted string. This loop occurs for ever '%' in the formatString.
|
toString | static String toString(double dblValue, int precision, int base)(Code) | | |
|
|