summaryrefslogtreecommitdiff
path: root/fpcdocs/unutilex/ex69.pp
blob: 9bcb1bbb6541200652a0f9340b3a683a3f72730e (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
27
Program Example69;

{ Program to demonstrate the FNMatch function. }

Uses unixutil;

  Procedure TestMatch(Pattern,Name : String);

  begin
    Write ('"',Name,'" ');
    If FNMatch (Pattern,Name) then
      Write ('matches')
    else
      Write ('does not match');
    Writeln(' "',Pattern,'".');
  end;

begin
  TestMatch('*','FileName');
  TestMatch('.*','FileName');
  TestMatch('*a*','FileName');
  TestMatch('?ile*','FileName');
  TestMatch('?','FileName');
  TestMatch('.?','FileName');
  TestMatch('?a*','FileName');
  TestMatch('??*me?','FileName');
end.