home contribute faq download

FunctX XSLT Functions

functx:repeat-string

Repeats a string a given number of times

Google
Webdatypic.com

Description

The functx:repeat-string function returns a string consisting of a given number of copies of $stringToRepeat concatenated together. To pad a string to a particular length, use the functx:pad-string-to-length function.

Arguments and Return Type

NameTypeDescription
$stringToRepeat xs:string? the string to repeat
$count xs:integer the desired number of copies
return value xs:string

XSLT Function Declaration

See XQuery definition.
<xsl:function name="functx:repeat-string" as="xs:string"
              xmlns:functx="http://www.functx.com">
  <xsl:param name="stringToRepeat" as="xs:string?"/>
  <xsl:param name="count" as="xs:integer"/>

  <xsl:sequence select="
   string-join((for $i in 1 to $count return $stringToRepeat),
                        '')
 "/>

</xsl:function>

Examples

XPath ExampleResults
functx:repeat-string('*', 6)
******
functx:repeat-string('abc', 3)
abcabcabc

See Also

functx:pad-string-to-lengthPads a string to a desired length
functx:pad-integer-to-lengthPads an integer to a desired length by adding leading zeros

History

Published OnLast UpdatedContributor(s)
2006-06-272007-02-26Priscilla Walmsley, Datypic, pwalmsley@datypic.com, https://www.datypic.com
Datypic XSLT Services

Recommended Reading:

XQuery