1 .\" Copyright (c) 2000 Andries Brouwer (aeb@cwi.nl)
3 .\" This is free documentation; you can redistribute it and/or
4 .\" modify it under the terms of the GNU General Public License as
5 .\" published by the Free Software Foundation; either version 2 of
6 .\" the License, or (at your option) any later version.
8 .\" The GNU General Public License's references to "object code"
9 .\" and "executables" are to be interpreted as the output of any
10 .\" document formatting or typesetting system, including
11 .\" intermediate and printed output.
13 .\" This manual is distributed in the hope that it will be useful,
14 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
15 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 .\" GNU General Public License for more details.
18 .\" You should have received a copy of the GNU General Public
19 .\" License along with this manual; if not, write to the Free
20 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
23 .\" Japanese Version Copyright (c) 2001 NAKANO Takeo all rights reserved.
24 .\" Translated Thu Fri 08 2001 by NAKANO Takeo <nakano@apm.seikei.ac.jp>
26 .\"WORD: numeric fill character 数値埋め文字
27 .\"WORD: grouping character グループ化文字
28 .\"WORD: left precision 左精度
29 .\"WORD: right precision 左精度
30 .\"WORD: radix (character) 基数点(文字)
31 .\"WORD: conversion character 変換文字
32 .\"WORD: international currency format 国際通貨フォーマット
33 .\"WORD: national currency format 国内通貨フォーマット
35 .TH STRFMON 3 2000-12-05 "Linux" "Linux Programmer's Manual"
37 .\"O strfmon \- convert monetary value to a string
39 strfmon \- 金額の値を文字列に変換する
42 .B #include <monetary.h>
44 .BI "ssize_t strfmon(char *" s ", size_t " max ", const char *" format ,
50 .\"O function formats the specified amounts
51 .\"O according to the format specification \fIformat\fP and places the
52 .\"O result in the character array \fIs\fP of size \fImax\fP.
56 で指定されたフォーマットにしたがって整形し、
63 .\"O Ordinary characters in \fIformat\fP are copied to \fIs\fP
64 .\"O without conversion.
65 .\"O Conversion specifiers are introduced by a \(aq%\(aq
67 .\"O Immediately following it there can be zero or more
68 .\"O of the following flags:
72 にコピーされる。変換指定は \(aq%\(aq 文字で始まる。
73 この直後には、以下のフラグを 0 個以上続けることができる。
76 .\"O The single-byte character
78 .\"O is used as the numeric fill character (to be used with
79 .\"O a left precision, see below).
80 .\"O When not specified, the space character is used.
83 を数値埋め文字 (numeric fill character) にする
88 .\"O Do not use any grouping characters that might be defined
89 .\"O for the current locale.
90 .\"O By default, grouping is enabled.
91 現在のロケールで定義されているであろうグループ化文字 (grouping character)
92 を一切使わない。デフォルトではグループ化は有効になっている。
96 .\"O The ( flag indicates that negative amounts should be enclosed between
98 .\"O The + flag indicates that signs should be handled
99 .\"O in the default way, that is, amounts are preceded by the locale's
100 .\"O sign indication, for example, nothing for positive, "\-" for negative.
101 ( フラグは、負の数値を括弧で括ることを意味する。
102 + フラグは符号をデフォルトのように取り扱うことを意味する
103 (すなわち数値の前にロケールの符号マークが置かれる。
104 例えば正ならなにもなく、負なら \(aq\-\(aq を置く、など)。
107 .\"O Omit the currency symbol.
111 .\"O Left justify all fields.
112 .\"O The default is right justification.
113 すべてのフィールドを左詰めにする。デフォルトは右詰め。
115 .\"O Next, there may be a field width: a decimal digit string specifying
116 .\"O a minimum field width in bytes.
117 .\"O The default is 0.
118 .\"O A result smaller than this width is padded with spaces
119 .\"O (on the left, unless the left-justify flag was given).
120 次の位置には、フィールドの幅を指定できる。
121 10 進の数値文字列で、フィールドの最小幅をバイト単位で指定する。
125 (左詰めフラグが指定されていなければ左側が埋められる)。
127 .\"O Next, there may be a left precision of the form "#" followed by
128 .\"O a decimal digit string.
129 .\"O If the number of digits left of the
130 .\"O radix character is smaller than this, the representation is
131 .\"O padded on the left with the numeric fill character.
132 .\"O Grouping characters are not counted in this field width.
133 次の位置には、"#" に 10 進数値文字列を続けた形式で、
134 左精度 (left precision) を指定できる。
135 通貨の基数点 (radix) より左側の数値の桁数がこの指定より小さい場合は、
137 このフィールド幅の指定では、グループ化文字はカウントされない。
139 .\"O Next, there may be a right precision of the form "." followed by
140 .\"O a decimal digit string.
141 .\"O The amount being formatted is rounded to
142 .\"O the specified number of digits prior to formatting.
143 .\"O The default is specified in the
146 .\"O .I int_frac_digits
147 .\"O items of the current locale.
148 .\"O If the right precision is 0, no radix character is printed.
149 .\"O (The radix character here is determined by
150 .\"O .BR LC_MONETARY ,
151 .\"O and may differ from that specified by
152 .\"O .BR LC_NUMERIC .)
153 次の位置には、"." に 10 進数値文字列を続けた形式で、
154 右精度 (right precision) を指定できる。
155 整形される数値は、整形前にこの桁数に丸められる。
161 右精度が 0 の場合は、基数点文字 (radix character) は印字されない
168 .\"O Finally, the conversion specification must be ended with a
169 .\"O conversion character.
170 .\"O The three conversion characters are
171 最後に、変換指定は変換文字 (conversion character)
176 .\"O (In this case the entire specification must be exactly "%%".)
177 .\"O Put a \(aq%\(aq character in the result string.
178 (この場合は指定全体が "%%" でなければならない。)
179 結果の文字列に \(aq%\(aq 文字を書きこむ。
182 .\"O One argument of type
184 .\"O is converted using the locale's international currency format.
187 ロケールの国際通貨フォーマット (international currency format)
191 .\"O One argument of type
193 .\"O is converted using the locale's national currency format.
196 ロケールの国内通貨フォーマット (national currency format)
198 .\"O .SH "RETURN VALUE"
202 .\"O function returns the number of characters placed
203 .\"O in the array \fIs\fP, not including the terminating null byte,
204 .\"O provided the string, including the terminating null byte, fits.
205 .\"O Otherwise, it sets
209 .\"O returns \-1, and the contents of the array is undefined.
211 関数は、結果の文字列が終端の NULL バイトを含めて配列
215 に書きこまれた文字数を返す。NULL バイトは文字数に入らない。
222 .\"O .SH "CONFORMING TO"
224 .\"O Not in POSIX.1-2001.
225 .\"O Present on several other systems.
234 strfmon(buf, sizeof(buf), "[%^=*#6n] [%=*#6i]",
239 のような関数コールの出力は、オランダのロケールでは以下のような出力になる。
243 [ fl **1234,57] [ NLG **1 234,57]
246 .\"O in the Dutch locale (with fl for "florijnen" and NLG for Netherlands Guilders).
247 (fl は "florijnen" の意。NLG は Netherlands Guilder。)
248 .\"O The grouping character is very ugly because it takes as much space
249 .\"O as a digit, while it should not take more than half that,
250 .\"O and will no doubt cause confusion.
251 .\"O Surprisingly, the "fl" is preceded and followed by a space,
252 .\"O and "NLG" is preceded by one and followed by two spaces.
253 .\"O This may be a bug in the locale files.
254 .\"O The Italian, Australian, Swiss
255 .\"O and Portuguese locales yield
257 同時に間違いなく混乱の原因にもなってしまうだろう。
259 数値と同じだけの幅を取ってしまうからである。
260 ひどいことに、 "fl" の前後にはスペースが入ってしまい、
261 また "NLG" の前には 1 つ、後には 2 つのスペースが置かれている。
263 イタリア・オーストラリア・スイス・ポルトガルの
267 [ L. **1235] [ ITL **1.235]
269 [ $**1234.57] [ AUD **1,234.57]
271 [Fr. **1234,57] [CHF **1.234,57]
273 [ **1234$57Esc] [ **1.234$57PTE ]