summaryrefslogtreecommitdiff
path: root/fpcdocs/progex/subs.pp
blob: 1786ee3d1c3f82eaec3586fe0cd9166c6d22ce6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{
  Example library
}
library subs;

function SubStr(CString: PChar;FromPos,ToPos: Longint): PChar; cdecl; 

var
  Length: Integer;

begin
  Length := StrLen(CString);
  SubStr := CString + Length;
  if (FromPos > 0) and (ToPos >= FromPos) then
  begin
    if Length >= FromPos then
      SubStr := CString + FromPos - 1;
    if Length > ToPos then
    CString[ToPos] := #0;
  end;
end;

exports
  SubStr;

end.