Difference between revisions of "String Module"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
− | {{Announce|Updated with Version 10:}} Renamed from ''Strings Module'' to ''String Module''. | + | {{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 computations. | This [[Module Library|XQuery Module]] contains functions for string computations. | ||
Line 5: | Line 5: | ||
=Conventions= | =Conventions= | ||
− | All functions and errors in this module and errors are assigned to the <code><nowiki>http://basex.org/modules/ | + | All functions and errors in this module and errors are assigned to the <code><nowiki>http://basex.org/modules/string</nowiki></code> namespace, which is statically bound to the {{Code|string}} prefix.<br/> |
=Functions= | =Functions= | ||
Line 67: | Line 67: | ||
;Version 10.0 | ;Version 10.0 | ||
− | * Updated: Renamed from ''Strings Module'' to ''String Module''. | + | * Updated: Renamed from ''Strings Module'' to ''String Module''. The namespace URI has been updated as well. |
The Module was introduced with Version 8.3. | The Module was introduced with Version 8.3. |
Revision as of 18:17, 18 July 2022
Updated with Version 10: Renamed from Strings Module to String Module. The namespace URI has been updated as well.
This XQuery Module contains functions for string computations.
Contents
Conventions
All functions and errors in this module and errors are assigned to the http://basex.org/modules/string
namespace, which is statically bound to the string
prefix.
Functions
strings:levenshtein
Signatures | strings:levenshtein($string1 as xs:string, $string2 as xs:string) as xs:double |
Summary | Computes the Damerau-Levenshtein Distance for two strings and returns a double value (0.0 - 1.0 ). The returned value is computed as follows:
|
Examples |
<syntaxhighlight lang="xquery"> let $norm := ft:normalize(?, map { 'stemming': true() }) return strings:levenshtein($norm("HOUSES"), $norm("house")) </syntaxhighlight> |
strings:soundex
Signatures | strings:soundex($string as xs:string) as xs:string |
Summary | Computes the Soundex value for the specified string. The algorithm can be used to find and index English words with similar pronouncation. |
Examples |
|
strings:cologne-phonetic
Signatures | strings:cologne-phonetic($string as xs:string) as xs:string |
Summary | Computes the Kölner Phonetik value for the specified string. Similar to Soundex, the algorithm is used to find similarly pronounced words, but for the German language. As the first returned digit can be 0 , the value is returned as string.
|
Examples |
|
Changelog
- Version 10.0
- Updated: Renamed from Strings Module to String Module. The namespace URI has been updated as well.
The Module was introduced with Version 8.3.