Processing (BETA) version 135+ のリファレンスです。 旧バージョン使用者はソフトウェア内のリファレンスを参照してください。
この文書は Processing のAPIリファレンスを日本語に訳したものです。 最新の内容は 英語版 で確認して下さい。


Name

nf()

Examples
int a=200, b=40, c=90;
String sa = nf(a, 10);
println(sa); // prints "0000000200"
String sb = nf(b, 5);
println(sb); // prints "00040"
String sc = nf(c, 3);
println(sc); // prints "090"

float d = 200.94, e = 40.2, f = 9.012;
String sd = nf(d, 10, 4);
println(sd);  // prints "0000000200.9400"
String se = nf(e, 5, 3);
println(se);  // prints "00040.200"
String sf = nf(f, 3, 5);
println(sf);  // prints "009.01200"
Description 数値を文字列にフォーマットするための効用関数です。 float フォーマット用と int フォーマット用の2つがあります。 digits, left, right パラメタに指定する値は常に正の整数にしてください。
Syntax
nf(intValue, digits)
nf(floatValue, left, right)
Parameters
intValue int or int[]: the number(s) to format
digits int: number of digits to pad with zeroes
floatValue float or float[]: the number(s) to format
left int: number of digits to the left of the decimal point
right int: number of digits to the right of the decimal point
Usage Web & Application
Related nfs()
nfp()
nfc()
Updated on May 24, 2007 06:11:18pm PDT

Creative Commons License

この文書の原文はクリエイティブ・コモンズ(Creative Commons)Attribution-Noncommercial-Share Alike(表示・非営利・継承) ライセンスで公開されています。 このライセンスは同一の許諾条件の下で原作者のクレジットを表示し、また作品を営利目的で利用しなければ、作品に対して複製、頒布、展示、実演、二次的著作物の作成が行えることを示します。

© 2007 Processing.org