« PosEx (rtl) » : différence entre les versions
Aucun résumé des modifications |
Aucun résumé des modifications |
||
Ligne 55 : | Ligne 55 : | ||
Voir aussi: | Voir aussi: | ||
*[[Pos (rtl)|Pos]] | |||
*[[StringPart (rtl)|StringPart]] | *[[StringPart (rtl)|StringPart]] | ||
{{Footer|Développement DSM}} | {{Footer|Développement DSM}} | ||
[[category:RTL Chaîne]] | [[category:RTL Chaîne]] |
Dernière version du 11 août 2009 à 13:50
<source lang='delphi'>Function PosEx(const SubStr:string; const S:string; Offset:Integer):Integer;</source>
Cette fonction retourne la position d'une sous chaîne dans une chaîne en commençant à une certaine position.
Result | Position de la sous chaîne, 0 si pas trouvé. |
SubStr | Sous chaîne recherchée. |
S | Chaîne |
Offset | Position de début de recherche. |
Exemple
Implémentation de la fonction StringPart <source lang='delphi'> function StringPart(const AString,ASep:string; Index:Integer):string; var xs,xe:Integer; begin
xs := 1; while xs<=length(AString) do begin xe := PosEx(ASep,AString,xs); if xe<>0 then begin if Index=0 then begin Result := Copy(AString,xs,xe-xs); Exit; end; xs := xe+1; end else begin if Index=0 then begin Result := Copy(AString,xs,length(AString)-xs+1); Exit; end; xs := length(AString)+1; end; dec(Index); end; Result := ;
end; </source>
Voir aussi:
{{#if:Développement DSM|
{{#if:Développement DSM|— Développement DSM |}} — Développement DSM —
|
{{#if:|— [[{{{1}}}]] |}} — Développement DSM —
}}