String Enclose Example

The viper string.enclose adds a prefix and/or suffix to the given string, but only if the source string is non-empty.

Smartsite SXML CopyCode image Copy Code
{string.enclose("mark", "water")} => "watermark"

{string.enclose("", "water")} => ""

{string.enclose("mark", "water", "ing")} => "watermarking"

{string.enclose("", "water", "ing")} => ""

{string.enclose("mark", "water", "")} => "watermark"

{string.enclose("mark", "", "ing")} => "marking"
Example Result CopyCode image Copy Code
watermark => "watermark"

 => ""

watermarking => "watermarking"

 => ""

watermark => "watermark"

marking => "marking"
SXML