« StringPart (rtl) » : différence entre les versions
Aucun résumé des modifications |
Aucun résumé des modifications |
||
| Ligne 1 : | Ligne 1 : | ||
<source lang='delphi'>Function StringPart(const AString:string; const ASep:string; Index:Integer):string;</source> | <source lang='delphi'>Function StringPart(const AString:string; const ASep:string; Index:Integer):string;</source> | ||
Cette fonction retourne une sous chaînes d'une chaînes constituée de sous chaînes séparées par un caractère séparateur. | |||
{|class="wikitable" | {|class="wikitable" | ||
|- | |- | ||
|Result | |Result | ||
| | |La sous chaîne d'index indiqué ou une chaîne vide si l'index ne correspond pas. | ||
|- | |- | ||
|AString | |AString | ||
| | |Une chaîne constituée de sous chaînes séparées par ASep | ||
|- | |- | ||
|ASep | |ASep | ||
| | |Un caractère séparateur. | ||
|- | |- | ||
|Index | |Index | ||
| | |L'index de la sous chaine à retourner. | ||
|} | |} | ||
| Ligne 25 : | Ligne 21 : | ||
<source lang='delphi'> | <source lang='delphi'> | ||
procedure foo(const s:string); | |||
begin | begin | ||
// s = foo1,foo2,foo3... | |||
if StringPart(s,',',1)='foo2' then | |||
begin | |||
end; | |||
end; | end; | ||
</source> | </source> | ||
Voir aussi: | Voir aussi: | ||
*[[ParseString (rtl)|ParseString]] | |||
*[[StringPartIndex (rtl)|StringPartIndex]] | |||
{{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:37
Function StringPart(const AString:string; const ASep:string; Index:Integer):string;
Cette fonction retourne une sous chaînes d'une chaînes constituée de sous chaînes séparées par un caractère séparateur.
| Result | La sous chaîne d'index indiqué ou une chaîne vide si l'index ne correspond pas. |
| AString | Une chaîne constituée de sous chaînes séparées par ASep |
| ASep | Un caractère séparateur. |
| Index | L'index de la sous chaine à retourner. |
Exemple
procedure foo(const s:string);
begin
// s = foo1,foo2,foo3...
if StringPart(s,',',1)='foo2' then
begin
end;
end;
Voir aussi: