home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / tcl / tcl7.0b1 / doc / format.n < prev    next >
Encoding:
Text File  |  1993-05-03  |  2.4 KB  |  57 lines

  1. '\"
  2. '\" Copyright (c) 1993 The Regents of the University of California.
  3. '\" All rights reserved.
  4. '\"
  5. '\" Permission is hereby granted, without written agreement and without
  6. '\" license or royalty fees, to use, copy, modify, and distribute this
  7. '\" documentation for any purpose, provided that the above copyright
  8. '\" notice and the following two paragraphs appear in all copies.
  9. '\"
  10. '\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
  11. '\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
  12. '\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
  13. '\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14. '\"
  15. '\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
  16. '\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  17. '\" AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
  18. '\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
  19. '\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  20. '\" 
  21. '\" $Header: /user6/ouster/tcl/man/RCS/format.n,v 1.1 93/05/03 17:09:44 ouster Exp $ SPRITE (Berkeley)
  22. '\" 
  23. .so man.macros
  24. .HS format tcl
  25. .BS
  26. '\" Note:  do not modify the .SH NAME line immediately below!
  27. .SH NAME
  28. format \- Format a string in the style of sprintf
  29. .SH SYNOPSIS
  30. \fBformat \fIformatString \fR?\fIarg arg ...\fR?
  31. .BE
  32.  
  33. .SH DESCRIPTION
  34. .PP
  35. This command generates a formatted string in the same way as the
  36. C \fBsprintf\fR procedure (it uses \fBsprintf\fR in its
  37. implementation).  \fIFormatString\fR indicates how to format
  38. the result, using \fB%\fR fields as in \fBsprintf\fR, and the additional
  39. arguments, if any, provide values to be substituted into the result.
  40. All of the \fBsprintf\fR options are valid; see the \fBsprintf\fR
  41. man page for details.
  42. .VS
  43. The \fBformat\fR command also supports the XPG3 ``%n$'' positional
  44. specifiers.
  45. .VE
  46. Each \fIarg\fR must match the expected type
  47. from the \fB%\fR field in \fIformatString\fR; the \fBformat\fR command
  48. converts each argument to the correct type (floating, integer, etc.)
  49. before passing it to \fBsprintf\fR for formatting.
  50. The only unusual conversion is for \fB%c\fR; in this case the argument
  51. must be a decimal string, which will then be converted to the corresponding
  52. ASCII character value.
  53. The return value from \fBformat\fR is the formatted string.
  54.  
  55. .SH KEYWORDS
  56. format, sprintf, string, substitution
  57.