fn:string-join

Return concatenation of string sequence.

Top of page

Related Syntax Constructs

The following construct(s) refer to this construct:


Syntax

fn:string-join(string* $stringSequence, string $separator) => string?

Description

This function returns a possibly empty string that is created by concatenating the members of $stringSequence using the value of $separator. If the value of $separator is a string of length zero, the members of $stringSequence are concatenated without a separator.

Arguments

$stringSequence

string value

$separator

string value

Examples

  • Some variants of simple string concatenation using different separators:

    string-join(('do', 're', 'mi', 'fa', 'so', 'la', 'si'), "")
    string-join(("veni", "vidi", "vici"), ", ")
    string-join(("line 1", "line 2", "line3"), "
")

    The first function call returns the string "doremifasolasi", the second returns "veni, vidi, vici", and the third call returns:

    line 1
    line 2
    line 3
  • For all doctors with pagers whose numbers start with a "3" change the pager number by prepending "11-":

    update for $a in input()//doctor
           let $b := $a/@pager
           where starts-with($b, "3")
        do replace $b
           with attribute pager { string-join(("11", $b), "-") }