string-join function

The fn:string-join function returns a string that is generated by concatenating items separated by a separator character.

Syntax

Read syntax diagramSkip visual syntax diagramfn:string-join( sequence, separator)
sequence
The sequence of items that are to be concatenated to form a string.

sequence is any sequence of xs:string values, or an empty sequence.

separator
A delimiter that is inserted into the resulting string between items from sequence.

separator has a data type of xs:string.

Returned value

The returned value is a string that is the concatenation of the items in sequence, separated by separator. If separator is a zero-length string, the items in sequence are concatenated without a separator. If sequence is an empty sequence, a zero-length string is returned.

Example

The following function returns the string that is the result of concatenating the items in the sequence ("I" , "made", "a", "sentence!"), using the whitespace character as a separator:
fn:string-join(("I" , "made", "a", "sentence!"), " ")

The returned value is the string "I made a sentence!"