Janilabo

Janilabo | TSAContains() [SCAR Divi]

Apr 27th, 2013
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.75 KB | None | 0 0
  1. {==============================================================================]  
  2.   Explanation: Returns true if TSA contains x.                    
  3. [==============================================================================}
  4. function TSAContains(TSA: TStrArray; x: string): Boolean;
  5. var
  6.   i, h: Integer;
  7. begin
  8.   h := High(TSA);
  9.   for i := 0 to h do
  10.   begin
  11.     Result := (x = TSA[i]);
  12.     if Result then
  13.       Exit;
  14.   end;
  15.   Result := False;
  16. end;
  17.  
  18. var
  19.   tmp: TStrArray;
  20.  
  21. begin      
  22.   ClearDebug;
  23.   tmp := ['a', 'b', 'c'];
  24.   if TSAContains(tmp, 'a') then
  25.     WriteLn('A!');
  26.   if TSAContains(tmp, 'b') then
  27.     WriteLn('B!');
  28.   if TSAContains(tmp, 'c') then
  29.     WriteLn('C!');
  30.   if TSAContains(tmp, 'd') then
  31.     WriteLn('D!');  
  32. end.
Advertisement
Add Comment
Please, Sign In to add comment