| FindPart searches the string InputStr and returns the first string that 
matches
| the wildcards specification in HelpWilds . If no match is found, and empty 
string
| is returned. valid wildcards are the "?" (question mark) and "*" (asterisk)
| characters."

To answer my own question ;-) here is the proposed help doc changes.

Description

FindPart searches the string InputStr and returns an integer, which is the 
first position 
of a string matched. The HelpWilds constant is a string which can contain Help 
Wilds.
 If no match is found, the integer 0 is returned. Valid Help Wilds are the 
"?" (question mark) and "*" (asterisk) characters.

Notes: The positioning starts at 1, not 0. 
           0 indicates no match found, and 1 indicates the first position.
           This is because the creators of freepascal are not mathematecians. 
(ok omit this one). 
           


Example program:

program Project1;

{$mode objfpc}{$H+}

uses
  Classes,
  sysutils,
  strutils;
 
begin
  writeln('Hello, where is "is" in "thisisatest"?');
  readln;
{should return 3...}
  writeln('It is at position: '+inttostr(FindPart('is','thisisatest')));
  readln;
{should return 0...}  
 writeln('inttostr(FindPart('ZZZXXX','thisisatest'))); 
  readln;
end.

The program should return the integer "3" due to the fact that the first 
instance of "is" happens to be in the 3rd position in "thisisatest".

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to