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

join()

Examples
String[] animals = new String[3]; 
animals[0] = "cat"; 
animals[1] = "seal"; 
animals[2] = "bear"; 
String joinedAnimals = join(animals, " : "); 
println(joinedAnimals);  // Prints "cat : seal : bear" 

// Joining an array of ints requires first
// converting to an array of Strings
int[] numbers = new int[3]; 
numbers[0] = 8; 
numbers[1] = 67; 
numbers[2] = 5; 
String joinedNumbers = join(nf(numbers, 0), ", "); 
println(joinedNumbers);  // Prints "8, 67, 5" 

Description Combines an array of Strings into one String, each separated by the character(s) used for the separator parameter. To join arrays of ints or floats, it's necessary to first convert them to Strings using nf() or nfs().
Syntax
join(list, separator)
Parameters
list String[]: array of Strings
separator char: char or String to be placed between each item
ReturnsString
Relatedsplit()
trim()
nf()
nfs()
Updated on January 21, 2019 10:05:10am EST

Creative Commons License