Janilabo

Janilabo | TSAEquals() [SCAR Divi]

Apr 27th, 2013
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.79 KB | None | 0 0
  1. {==============================================================================]  
  2.   Explanation: Returns true if TSA1 is identical with TSA2.                  
  3. [==============================================================================}
  4. function TSAEquals(TSA1, TSA2: TStrArray): Boolean;
  5. var
  6.   h, i: Integer;
  7. begin
  8.   Result := False;
  9.   h := High(TSA1);
  10.   if (h = High(TSA2)) then
  11.   begin
  12.     for i := 0 to h do
  13.       if (TSA1[i] <> TSA2[i]) then
  14.         Exit;
  15.     Result := True;  
  16.   end;
  17. end;  
  18.  
  19. begin          
  20.   ClearDebug;
  21.   if TSAEquals(['a', 'b', 'c'], ['a', 'b', 'c', 'd']) then
  22.     WriteLn('WTF!');
  23.   if TSAEquals(['a', 'b', 'c', 'd'], ['a', 'b', 'c']) then
  24.     WriteLn('WTF!');
  25.   if TSAEquals(['a', 'b', 'c', 'd'], ['a', 'b', 'c', 'd']) then
  26.     WriteLn('YAY!');
  27. end.
Advertisement
Add Comment
Please, Sign In to add comment