Changes

Jump to navigation Jump to search
252 bytes removed ,  18:36, 1 December 2023
m
Text replacement - "<syntaxhighlight lang="xquery">" to "<pre lang='xquery'>"
{{Announce|Updated with Version 10:}} Renamed from ''Strings Module'' to ''String Module''. The namespace URI has been updated as well.
 
This [[Module Library|XQuery Module]] contains functions for string operations and computations.
{| width='100%'
|- valign="top"
| width='120' | '''SignaturesSignature'''|{{Func|<pre>string:levenshtein|( $string1 as xs:string, $string2 as xs:string|) as xs:double}}<br/pre>
|- valign="top"
| '''Summary'''
* {{Code|string:levenshtein("flower", "lewes")}} returns {{Code|0.5}}
* In the following query, the input is first normalized (words are stemmed, converted to lower case, and diacritics are removed). It returns {{Code|1}}:
<syntaxhighlight pre lang="'xquery"'>
let $norm := ft:normalize(?, map { 'stemming': true() })
return string:levenshtein($norm("HOUSES"), $norm("house"))
</syntaxhighlightpre>
|}
{| width='100%'
|- valign="top"
| width='120' | '''SignaturesSignature'''|{{Func|<pre>string:soundex|( $string as xs:string|) as xs:string}}<br/pre>
|- valign="top"
| '''Summary'''
{| width='100%'
|- valign="top"
| width='120' | '''SignaturesSignature'''|{{Func|<pre>string:cologne-phonetic|( $string as xs:string|) as xs:string}}<br/pre>
|- valign="top"
| '''Summary'''
=Formatting=
 
{{Announce|The functions in this section have been adopted from the obsolete Output Module.}}
==string:format==
{| width='100%'
|- valign="top"
| width='120' | '''SignaturesSignature'''|{{Func|<pre>string:format|( $format pattern as xs:string, $items values... as item() ...|) as xs:string}}<br/pre>
|- valign="top"
| '''Summary'''
|Returns a formatted string. The remaining arguments specified by {{Code|$itemsvalues}} are applied to incorported into the {{Code|$formatpattern}} string, according to [https://docs.oracle.com/javase/8/docs/api/java/util/Formatter.html#syntax Java’s printf syntax].
|- valign="top"
| '''Errors'''
{| width='100%'
|- valign="top"
| width='120' | '''SignaturesSignature'''
|{{Code|'''string:cr()''' as xs:string}}
|- valign="top"
{| width='100%'
|- valign="top"
| width='120' | '''SignaturesSignature'''
|{{Code|'''string:nl()''' as xs:string}}
|- valign="top"
{| width='100%'
|- valign="top"
| width='120' | '''SignaturesSignature'''
|{{Code|'''string:tab()''' as xs:string}}
|- valign="top"
Bureaucrats, editor, reviewer, Administrators
13,554

edits

Navigation menu