Loading TOC...

fn:string-join

fn:string-join(
   $parameter1 as xs:string*,
   $parameter2 as xs:string
) as xs:string

Summary

Returns an xs:string created by concatenating the members of the $parameter1 sequence using $parameter2 as a separator. If the value of $arg2 is the zero-length string, then the members of $parameter1 are concatenated without a separator.

If the value of $parameter1 is the empty sequence, the zero-length string is returned.

Parameters
$parameter1 A sequence of strings.
$parameter2 A separator string to concatenate between the items in $parameter1.

Example

fn:string-join(("hello", "goodbye"), " and ")

=> hello and goodbye

Example

let $string := "this is a string"
return
fn:string-join(fn:tokenize($string, " "),
               "-")

=> this-is-a-string

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.