GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Processing
  • Download
  • Reference
  • Environment
  • Libraries
  • Tools
  • Wiki
  • Tutorials
  • Examples
  • Books
  • Forum
  • Overview
  • People
  • Privacy

This view

  • Original page
  • New address

GeezerVison is showing processing.org — join() / Reference

Reference+
Documentation→Reference→Data→String Functions

Name

join()

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().

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" 
    
    

Syntax

  • join(list, separator)

Parameters

  • list(String[])array of Strings
  • separator(char, String)char or String to be placed between each item

Return

  • String

Related

  • split()
  • trim()
  • nf()
  • nfs()
Creative Commons License

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

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.