This reference is for Processing 3.0+. If you have a previous version, use the reference included with your software in the Help menu. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.
Name | str() |
---|---|
Examples | boolean b = false; byte y = -28; char c = 'R'; float f = -32.6; int i = 1024; String sb = str(b); String sy = str(y); String sc = str(c); String sf = str(f); String si = str(i); sb = sb + sy + sc + sf + si; println(sb); // Prints 'false-28R-32.61024' |
Description |
Converts any value of a primitive data type (boolean, byte, char, color, double, float, int, or long) to its String representation. For example, converting an integer with str(3) will return the String value of "3", converting a float with str(-12.6) will return "-12.6", and converting a boolean with str(true) will return "true". When an array of values is passed in, then a String array of the same length is returned. |