StrMatches

Qubes 6.3 Vérifie si une chaîne de caractères correspond à un modèle

Syntaxe

function StrMatches(str: String; mask: String): Boolean
str: chaîne à vérifier
mask: modèle

Remarques

Le modèle supporte les caractères "joker" suivants :

  • "?" : un caractère (quel qu'il soit)
  • "*" : 0 caractère ou plus (nombre indéterminé de caractères, pas forcément identiques)

Exemples

Print(StrMatches('', '')); // true
Print(StrMatches('', '*')); // true
Print(StrMatches('', '?')); // false

Print(StrMatches('toto', 'toto')); // true
Print(StrMatches('toto', '*')); // true

Print(StrMatches('toto', 't?t?')); // true
Print(StrMatches('titi', 't?t?')); // true

Print(StrMatches('toto', 'toto?')); // false
Print(StrMatches('toto', 'toto*')); // true

Print(StrMatches('toto', 'to*')); // true (<=> commence par 'to')
Print(StrMatches('titi', 'to*')); // false

Print(StrMatches('toti', '*i*')); // true (<=> contient 'i')
Print(StrMatches('toti', '*i?*')); // false (<=> contient 'i' mais pas à la fin seulement)

Classification

Internal