Fonctions sur les chaînes de caractères
Fonctions d'assemblage désassemblage
Fonction | Description |
---|---|
fn:codepoints-to-string($arg as xs:integer*) as xs:string | Assemble une séquence de caractères (exprimés par leur code UNICODE) en chaîne de caractères |
fn:string-to-codepoints($arg as xs:string?) as xs:integer* | Désassemble une chaîne de caractères en séquences de nombres représentant leur code UNICODE. |
Exemple :
Fonctions de comparaison
Fonction | Description |
---|---|
fn:compare($comparand1 as xs:string?, $comparand2 as xs:string?) as xs:integer? fn:compare( $comparand1 as xs:string?, $comparand2 as xs:string?, $collation as xs:string) as xs:integer? | Retourne :
en fonction de la collation choisie. |
fn:codepoint-equal( $comparand1 as xs:string?, $comparand2 as xs:string?) as xs:boolean? | Comparaison d'égalité stricte entre les chaînes de caractères (code UNICODE) |
Exemple :
Exemple :
Exemple :
Fonctions sur les chaînes de caractères
Fonction | Description |
---|---|
fn:concat( $arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?, ... ) as xs:string | Concaténation |
fn:string-join($arg1 as xs:string*) as xs:string fn:string-join($arg1 as xs:string*, $arg2 as xs:string) as xs:string | Concaténation utilisant un séparateur |
fn:substring($sourceString as xs:string?, $start as xs:double) as xs:string fn:substring( $sourceString as xs:string?, $start as xs:double, $length as xs:double) as xs:string | Extraction de chaîne de caractères |
fn:string-length($arg as xs:string?) as xs:integer | Longueur de la chaîne de caractères |
fn:normalize-space($arg as xs:string?) as xs:string | Suppression des espaces "inutiles" |
fn:upper-case($arg as xs:string?) as xs:string | Transforme le texte en lettres majuscules |
fn:lower-case($arg as xs:string?) as xs:string | Transforme le texte en lettres minuscules |
fn:translate( $arg as xs:string?, $mapString as xs:string, $transString as xs:string) as xs:string | Transforme la chaîne de caractères en remplaçant/supprimant des caractères par d'autres |
Exemple :
Exemple :
Fonctions de comparaison de sous-chaînes
Fonction | Description |
---|---|
fn:contains($arg1 as xs:string?, $arg2 as xs:string?) as xs:boolean fn:contains( $arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:boolean | Détermine si une chaîne en contient une autre (possibilité de préciser la collation) |
fn:starts-with($arg1 as xs:string?, $arg2 as xs:string?) as xs:boolean fn:starts-with( $arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:boolean | Détermine si une chaîne commence par une autre (possibilité de préciser la collation) |
fn:ends-with($arg1 as xs:string?, $arg2 as xs:string?) as xs:boolean fn:ends-with( $arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:boolean | Détermine si une chaîne se termine par une autre (possibilité de préciser la collation) |
fn:substring-before($arg1 as xs:string?, $arg2 as xs:string?) as xs:string fn:substring-before( $arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:string | Récupère la chaîne de caractères précédente d'une autre (possibilité de préciser la collation) |
fn:substring-after($arg1 as xs:string?, $arg2 as xs:string?) as xs:string fn:substring-after( $arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:string | Récupère la chaîne de caractères suivante d'une autre (possibilité de préciser la collation) |
Fonctions utilisant les expressions régulières
Pour plus d'information sur les expressions régulières, se référer à : http://www.w3.org/TR/xpath-functions-30/#regex-syntax
Fonction | Description |
---|---|
fn:matches($input as xs:string?, $pattern as xs:string) as xs:boolean fn:matches( $input as xs:string?, $pattern as xs:string, $flags as xs:string) as xs:boolean | Retourne true si une chaîne de caractères match l'expression régulière |
fn:replace( $input as xs:string?, $pattern as xs:string, $replacement as xs:string) as xs:string fn:replace( $input as xs:string?, $pattern as xs:string, $replacement as xs:string, $flags as xs:string) as xs:string | Remplace une sous-chaîne de caractères qui est conforme à une expression régulière |
fn:tokenize($input as xs:string?, $pattern as xs:string) as xs:string* fn:tokenize( $input as xs:string?, $pattern as xs:string, $flags as xs:string) as xs:string* | Découpe une chaîne de caractères par un séparateur conforme à une expression régulière |
Pour les Flags disponibles se référer à : http://www.w3.org/TR/xpath-functions-30/#flags