StringPartIndex (rtl)

De Wiki1000
(Différences entre les versions)
 
 
Ligne 1 : Ligne 1 :
 
 
<source lang='delphi'>Function StringPartIndex(const AString:string; const ASep:string; const APart:string):Integer;</source>
 
<source lang='delphi'>Function StringPartIndex(const AString:string; const ASep:string; const APart:string):Integer;</source>
  
description
+
Cette fonction retourne l'index d'une sous chaîne dans une chaîne constituée de sous chaîne séparées par des caractères sep.
  
 
{|class="wikitable"
 
{|class="wikitable"
 
|-
 
|-
 
|Result
 
|Result
|
+
|L'index de la sous chaîne.
 
|-
 
|-
 
|AString
 
|AString
|
+
|La chaîne constituée de sous chaînes.
 
|-
 
|-
 
|ASep
 
|ASep
|
+
|Le caractère séparateur de sous chaîne.
 
|-
 
|-
 
|APart
 
|APart
|
+
|La sous chaîne recherchée.
|-
+
|Result
+
|
+
 
|}
 
|}
  
Ligne 25 : Ligne 21 :
  
 
<source lang='delphi'>
 
<source lang='delphi'>
 +
procedure foo(const s:string);
 
begin
 
begin
 +
  // s = foo1,foo2,foo3,...
 +
  if StringPartIndex(s,',','foo2')=1 then
 +
  begin
 +
  ...
 +
  end;
 
end;
 
end;
 
</source>
 
</source>
  
 
Voir aussi:
 
Voir aussi:
 +
 +
*[[StringPart (rtl)|StringPart]]
  
 
{{Footer|Développement DSM}}
 
{{Footer|Développement DSM}}
 
[[category:RTL Chaîne]]
 
[[category:RTL Chaîne]]

Version actuelle en date du 11 août 2009 à 15:40

Function StringPartIndex(const AString:string; const ASep:string; const APart:string):Integer;

Cette fonction retourne l'index d'une sous chaîne dans une chaîne constituée de sous chaîne séparées par des caractères sep.

Result L'index de la sous chaîne.
AString La chaîne constituée de sous chaînes.
ASep Le caractère séparateur de sous chaîne.
APart La sous chaîne recherchée.

Exemple

procedure foo(const s:string);
begin
  // s = foo1,foo2,foo3,...
  if StringPartIndex(s,',','foo2')=1 then
   begin
   ...
   end;
end;

Voir aussi:

Développement DSMDéveloppement DSM





Whos here now:   Members 0   Guests 0   Bots & Crawlers 1
 
Outils personnels