Browse Subversion Repository
Contents of /trunk/doc/jp/html/macro/command/sprintf2.html
Parent Directory
| Revision Log
Revision 3221 -
( show annotations)
( download)
( as text)
Tue Mar 24 09:37:20 2009 UTC
(15 years, 2 months ago)
by maya
File MIME type: text/html
File size: 1844 byte(s)
CVS から SVN へ移行: trunk に集約
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=Shift_JIS"> |
6 |
<title>sprintf2</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>sprintf2</h1> |
15 |
|
16 |
<p> |
17 |
フォーマットされた出力を返す。 |
18 |
</p> |
19 |
|
20 |
<pre class="macro-syntax"> |
21 |
sprintf2 strvar FORMAT [ARGUMENT ...] |
22 |
</pre> |
23 |
|
24 |
<h2>解説</h2> |
25 |
|
26 |
<p> |
27 |
C言語の書式指定にしたがって、引数の数値や文字列をフォーマットして、文字列型変数 <strvar> に代入する。<br> |
28 |
<a href="sprintf.html">sprintf</a> とは違い、任意の変数に結果を格納できる。 |
29 |
</p> |
30 |
|
31 |
<table> |
32 |
<caption>サポートされている書式指定</caption> |
33 |
<tr> |
34 |
<th>型</th> |
35 |
<td>c, d, i, o, u, x, X, e, E, f, g, G, a, A および s</td> |
36 |
</tr> |
37 |
<tr> |
38 |
<th>フラグ(オプション)</th> |
39 |
<td>-, +, 0, # および 空白(' ')</td> |
40 |
</tr> |
41 |
<tr> |
42 |
<th>幅(オプション)</th> |
43 |
<td>10進整数</td> |
44 |
</tr> |
45 |
<tr> |
46 |
<th>精度(オプション)</th> |
47 |
<td>ピリオド (.) に続けて、負でない10進整数(オプション)</td> |
48 |
</tr> |
49 |
</table> |
50 |
|
51 |
<p> |
52 |
このコマンドの結果、以下のうちの一つの値がシステム変数 result に格納される。 </p> |
53 |
|
54 |
<table> |
55 |
<tr> |
56 |
<th>値</th> |
57 |
<th>状態</th> |
58 |
</tr> |
59 |
<tr> |
60 |
<td>0</td> |
61 |
<td>成功した</td> |
62 |
</tr> |
63 |
<tr> |
64 |
<td>1</td> |
65 |
<td>書式指定がない</td> |
66 |
</tr> |
67 |
<tr> |
68 |
<td>2</td> |
69 |
<td>書式指定が不正</td> |
70 |
</tr> |
71 |
<tr> |
72 |
<td>3</td> |
73 |
<td>引数が不正</td> |
74 |
</tr> |
75 |
<tr> |
76 |
<td>4</td> |
77 |
<td>格納先変数が不正</td> |
78 |
</tr> |
79 |
</table> |
80 |
|
81 |
<h2>例</h2> |
82 |
|
83 |
<pre class="macro-example"> |
84 |
sprintf2 ver 'Tera Term 4.%d' 51 |
85 |
messagebox ver 'sprintf test(1)' |
86 |
|
87 |
sprintf2 win 'Windows %d (+%s)' 2000 'SP4' |
88 |
messagebox win 'sprintf test(2)' |
89 |
|
90 |
sprintf2 test '%s=%d %s=0x%x' 'dec' 10 'hex' 33 |
91 |
messagebox test 'sprintf test macro(3)' |
92 |
</pre> |
93 |
|
94 |
<h2>参照</h2> |
95 |
|
96 |
<ul> |
97 |
<li>"<a href="sprintf.html">sprintf</a>"</li> |
98 |
</ul> |
99 |
|
100 |
</BODY> |
101 |
</HTML> |
| |