Of course another way that hasn't occured to me till now, is to have a
little library routine called hasPosition, say.
const
STRING_NOT_FOUND :integer = -1;
AUDIO_EXTENSIONS :array[1..3] of string = ('wav','ogg','midi');
function hasPosition(const s:string; all :array of string):integer;
var
ix :integer;
begin
for ix := low(all) to high(all) do
if compareText(s,all[ix])=0 then
begin
result := ix;
exit;
end;
result := NOT_FOUND;
end;
Sample uses
if hasPosition(edit1.text,['bill','tom','harry']) = STRING_NOT_FOUND
or hasPosition(edit1.text,AUDIO_EXTENSIONS) = STRING_NOT_FOUND then
I'm pretty sure that however you declare the array (e.g 1..3), it is forced
into a zero base array when passed in (e.g. 0..2)
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/