Reference×
Reference
- [] (array access)
- = (assign)
- catch
- class
- , (comma)
- // (comment)
- {} (curly braces)
- /** */ (doc comment)
- . (dot)
- draw()
- exit()
- extends
- false
- final
- implements
- import
- loop()
- /* */ (multiline comment)
- new
- noLoop()
- null
- () (parentheses)
- popStyle()
- pop()
- private
- public
- pushStyle()
- push()
- redraw()
- return
- ; (semicolon)
- setLocation()
- setResizable()
- setTitle()
- setup()
- static
- super
- this
- thread()
- true
- try
- void
Name
str()
Description
Converts a value of a primitive data type (boolean, byte, char, int, or float) 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.
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'

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.