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


Name

nfs()

Examples
int a=200, b=-40, c=90; 
String sa = nfs(a, 10); 
println(sa); // prints " 0000000200" 
String sb = nfs(b, 5); 
println(sb); // prints "-00040" 
String sc = nfs(c, 3); 
println(sc); // prints " 090" 
 
float d = -200.94, e = 40.2, f = -9.012; 
String sd = nfs(d, 10, 4); 
println(sd);  // prints "-0000000200.9400" 
String se = nfs(e, 5, 3); 
println(se);  // prints " 00040.200" 
String sf = nfs(f, 3, 5); 
println(sf);  // prints "-009.01200"
Description 数値を文字列にフォーマットするための効用関数です。 nf() に似た動作をしますが正の数の先頭に空白を残すことで、不の数に "-" を付加しても位置がそろいます。 float フォーマット用と int フォーマット用の2つがあります digits, left, right パラメタに指定する値は常に正の整数にしてください。
Syntax
nfs(intValue, digits)
nfs(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 nf()
nfp()
nfc()
Updated on September 23, 2006 05:40:18pm PDT

Creative Commons License

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

© 2007 Processing.org