Table des matières

Comparaison Recherche de texte

Comparaisons

CompareText
function CompareText(const S1, S2: string): Integer; overload;
function CompareText(const S1, S2: string; LocaleOptions: TLocaleOptions): Integer; overload;

Compare deux textes sans tenir compte des majuscules/minuscules

Avec les Wildcards (*/?)

IsWild

Declaration: function IsWild(InputStr, Wilds: string; IgnoreCase: Boolean): Boolean;

IsWild compare InputString with WildCard string and return True if corresponds.

IsWild example:
There are possible masks and corresponding strings:
* : >= 0 letters;
*A : words with >= 1 letters and A at the end;
A*A : words with >= 2 letters and A at the begin and end;
A* : words with >= 1 letters and A at the begin;
? : one letter.

FindPart

Declaration: function FindPart(const HelpWilds, InputStr: string): Integer;

FindPart compares a string with '?' and another, returns the position of HelpWilds in InputStr.

FindPart example:

var P: Integer; Wild: string;
begin
  Wild := '?im';
  P := FindPart(Wild, 'Let him go');
  { here P = 5 }
end;
Dans TStringList

Dans la propertie TStringList.Filter, on peut utiliser les Wildcards (a creuser…)

Recherches

Pos

https://www.freepascal.org/docs-html/rtl/system/pos.html

Recherche la position d'un Substring dans un String.

Sources & Ressources