Concatenate Elements in a String Collection

Product 25/09/2013 by Jan Petter Bergfjord

Introduced the function join for the String class in the Genus Application Framework Language.
 
Syntax
String.join(separator, values, includeNullOrEmpty)
 
Description
Concatenates all the elements of a string collection using the specified separator between each element.
 
Return Type
string
If the string collections contains no elements, the function returns an empty string.
 
Arguments
separator
Type: String
The string to use as a separator. The string is included in the returned string only if the collection has more than one element.
 
values
Type: Collection(String)
A collection that contains the strings to concatenate.
 
includeNullOrEmpty
Type: Boolean
TRUE to include collection elements that are null or the empty string; otherwise FALSE to exclude such elements before concatenation.
 
Examples
Create a string containing the first, middle, and last name for a person object, where each element is separated by a space.
String.join(" ", [person.firstName, person.middleName, person.lastName], false)
 
Create a semicolon separated string containing registered addresses for a person object:
String.join(“;”, person.addresses.displayName, false)