[fpc-pascal] FindPart function - Help Docs say...
L505
fpc505 at z505.com
Sun May 15 06:35:27 CEST 2005
| 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".
More information about the fpc-pascal
mailing list