home contribute faq download

FunctX XQuery Functions

functx:reverse-string

Reverses the order of characters

Google
Webxqueryfunctions.com

Description

The functx:reverse-string function reverses the order of characters in a string. It returns a zero-length string if the argument is the empty sequence.

Arguments and Return Type

NameTypeDescription
$arg xs:string? the string to reverse
return value xs:string

XQuery Function Declaration

See XSLT definition.
declare namespace functx = "http://www.functx.com";
declare function functx:reverse-string
  ( $arg as xs:string? )  as xs:string {

   codepoints-to-string(reverse(string-to-codepoints($arg)))
 } ;

Examples

XQuery ExampleResults
functx:reverse-string('abc')
cba
functx:reverse-string('a')
a

See Also

fn:reverseReverses the order of a sequence

History

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

Recommended Reading:

XQuery