home *** CD-ROM | disk | FTP | other *** search
- '\"
- '\" Copyright (c) 1993 The Regents of the University of California.
- '\" All rights reserved.
- '\"
- '\" Permission is hereby granted, without written agreement and without
- '\" license or royalty fees, to use, copy, modify, and distribute this
- '\" documentation for any purpose, provided that the above copyright
- '\" notice and the following two paragraphs appear in all copies.
- '\"
- '\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
- '\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
- '\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
- '\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- '\"
- '\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- '\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- '\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- '\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
- '\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- '\"
- '\" $Header: /user6/ouster/tcl/man/RCS/format.n,v 1.1 93/05/03 17:09:44 ouster Exp $ SPRITE (Berkeley)
- '\"
- .so man.macros
- .HS format tcl
- .BS
- '\" Note: do not modify the .SH NAME line immediately below!
- .SH NAME
- format \- Format a string in the style of sprintf
- .SH SYNOPSIS
- \fBformat \fIformatString \fR?\fIarg arg ...\fR?
- .BE
-
- .SH DESCRIPTION
- .PP
- This command generates a formatted string in the same way as the
- C \fBsprintf\fR procedure (it uses \fBsprintf\fR in its
- implementation). \fIFormatString\fR indicates how to format
- the result, using \fB%\fR fields as in \fBsprintf\fR, and the additional
- arguments, if any, provide values to be substituted into the result.
- All of the \fBsprintf\fR options are valid; see the \fBsprintf\fR
- man page for details.
- .VS
- The \fBformat\fR command also supports the XPG3 ``%n$'' positional
- specifiers.
- .VE
- Each \fIarg\fR must match the expected type
- from the \fB%\fR field in \fIformatString\fR; the \fBformat\fR command
- converts each argument to the correct type (floating, integer, etc.)
- before passing it to \fBsprintf\fR for formatting.
- The only unusual conversion is for \fB%c\fR; in this case the argument
- must be a decimal string, which will then be converted to the corresponding
- ASCII character value.
- The return value from \fBformat\fR is the formatted string.
-
- .SH KEYWORDS
- format, sprintf, string, substitution
-