Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {==============================================================================]
- Explanation: Returns true if TSA contains x.
- [==============================================================================}
- function TSAContains(TSA: TStrArray; x: string): Boolean;
- var
- i, h: Integer;
- begin
- h := High(TSA);
- for i := 0 to h do
- begin
- Result := (x = TSA[i]);
- if Result then
- Exit;
- end;
- Result := False;
- end;
- var
- tmp: TStrArray;
- begin
- ClearDebug;
- tmp := ['a', 'b', 'c'];
- if TSAContains(tmp, 'a') then
- WriteLn('A!');
- if TSAContains(tmp, 'b') then
- WriteLn('B!');
- if TSAContains(tmp, 'c') then
- WriteLn('C!');
- if TSAContains(tmp, 'd') then
- WriteLn('D!');
- end.
Advertisement
Add Comment
Please, Sign In to add comment