| Language \ Environment \ Comparison |

| Index

| The Processing 1.0 _ALPHA_ Reference is a work in progress. If you see any errors or have any comments, please write to: reas at groupc.net

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 "090.01200"
Description |  | Utility function for formatting numbers into Strings. There are two versions, one for formatting floats and one for formatting ints. The values for parameters digits, left, and right should always be positive integers.
Syntax |  |
    nf(intValue, digits)
    nf(floatValue, left, right)
Parameters |  |
intValue |  | int: the number to format
digits |  | int: number of digits to pad with zeroes
floatValue |  | float: the number 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
Returns |  | String
Usage |  | Web & Application

| © 2004 - 2001 Massachusetts Institute of Technology and Interaction Design Institute Ivrea |
| Processing is an open project initiated by Ben Fry and Casey Reas |