Loading TOC...

MarkLogic 12 EA 2 Product Documentation
fn.stringJoin

fn.stringJoin(
   parameter1 as String[],
   parameter2 as String
) as 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.stringJoin(["hello", "goodbye"], " and ");

=> hello and goodbye

Example

var string = "this is a string";
fn.stringJoin(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.