SRL Archive - OSR Help

String containing an index of an array?


xxpoopyxx

2013-03-12 18:54:27

for i := 0 to Number do
begin
if ArrInStr(Array, String) then
begin
(Some Function to return the index of the array found in the string)
Break;
end;
end;

Le Jingle

2013-03-12 19:03:06

I believe you're looking for something like the code below:
(ALSO - Check out Janilabo's string handling commands in my signature! ;] )

{$i srl/srl.simba}
var
index: Integer;
s: string;
TSA: TStringArray;
begin
s := 'foo';
TSA := ['hello', 'world', 'foo', 'new', 'object'];
if (InStrArrEx(s, TSA, index)) then
Writeln('Saved index = ' + IntToStr(index) + '.');
end.

xxpoopyxx

2013-03-12 19:25:14

i love you