Open-Source-Software-Entwicklung und Downloads

Browse Subversion Repository

Contents of /trunk/doc/en/html/macro/command/sprintf.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3227 - (show annotations) (download) (as text)
Tue Mar 24 15:10:33 2009 UTC (15 years, 1 month ago) by maya
File MIME type: text/html
File size: 1918 byte(s)
CVS から SVN へ移行: 改行コードを LF から CR+LF へ変換
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2 "http://www.w3.org/TR/html4/strict.dtd">
3 <html>
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6 <title>sprintf</title>
7 <meta http-equiv="Content-Style-Type" content="text/css">
8 <link rel="stylesheet" href="../../style.css" type="text/css">
9 </head>
10
11 <body>
12
13
14 <h1>sprintf</h1>
15
16 <p>
17 Returns formatted output.
18 </p>
19
20 <pre class="macro-syntax">
21 sprintf FORMAT [ARGUMENT ...]
22 </pre>
23
24 <h2>Remarks</h2>
25
26 <p>
27 FORMAT controls the output as in C language printf with ARGUMENTs converted to proper type first.
28 The output string is stored in the string variable &lt;inputstr&gt;.
29 </p>
30
31 <table>
32 <caption>supported format style</caption>
33 <tr>
34 <th>type</th>
35 <td>c, d, i, o, u, x, X, e, E, f, g, G, a, A and s</td>
36 </tr>
37 <tr>
38 <th>flags(option)</th>
39 <td>-, +, 0, # and blank(' ')</td>
40 </tr>
41 <tr>
42 <th>width(option)</th>
43 <td>decimal integer</td>
44 </tr>
45 <tr>
46 <th>precision(option)</th>
47 <td>nonnegative decimal integer(option), preceded by a period(.)</td>
48 </tr>
49 </table>
50
51 <p>
52 As a result of this command, the system variable "result" is set to one of the following values.
53 </p>
54
55 <table>
56 <tr>
57 <th>Value</th>
58 <th>Status</th>
59 </tr>
60 <tr>
61 <td>0</td>
62 <td>Formatted successfully</td>
63 </tr>
64 <tr>
65 <td>1</td>
66 <td>No format string</td>
67 </tr>
68 <tr>
69 <td>2</td>
70 <td>Invalid format</td>
71 </tr>
72 <tr>
73 <td>3</td>
74 <td>Invalid argument</td>
75 </tr>
76 </table>
77
78 <h2>Example</h2>
79
80 <pre class="macro-example">
81 sprintf 'Tera Term 4.%d' 51
82 messagebox inputstr 'sprintf test(1)'
83
84 sprintf 'Windows %d (+%s)' 2000 'SP4'
85 messagebox inputstr 'sprintf test(2)'
86
87 sprintf '%s=%d %s=0x%x' 'dec' 10 'hex' 33
88 messagebox inputstr 'sprintf test macro(3)'
89 </pre>
90
91 <h2>See also</h2>
92
93 <ul>
94 <li>"<a href="sprintf2.html">sprintf2</a>"</li>
95 </ul>
96
97 </BODY>
98 </HTML>

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26