Essentially you don’t have much to do, you have to check item by item. Depending on what you want there are other data structures that can minimize the search time.
On the other hand, maybe what you want is just to ride one loop to sweep the whole array with a for in
:
var
Tabela : Array of String;
Str : String;
begin
Tabela[0] := 'Valor';
Tabela[1] := 'Value';
for Str in Tabela do
if Str = 'Valor' then
// do wathever;
end;
I just found out that it is very difficult to find official documentation about Delphi. But I found some things that talk about the for in
.
I found another way with for
normal in response in the OS. It’s sweeping the whole array similarly but manually going from index to index:
function StringInArray(const Value: string; Strings: array of string): Boolean;
var I: Integer;
begin
Result := True;
for I := Low(Strings) to High(Strings) do
if Strings[i] = Value then Exit;
Result := False;
end;
I put in the Github for future reference.