COURSE of the MONTH

search an array

I want make a function that will search an array.
Can I make just one function to search all data types (using the variant
data type) or do I need to make a seperate function for each type. ie one
for string, longint, double, etc.
I would like to use just one function but am not sure how you distinguish what data type has been passed as the variant array - or if in fact you can do this. I am using delphi 3.02

Who is Participating?

since clyde is using Delphi 3, he can't use overload. I don't know if the command "VarType" exists in D3, but you can check anyway. This would give you the type of the variant. If you want to convert your variant to a certain type, simply use the .AsInteger, .AsString, etc. after your variable. Like
"if MyVariant.AsString = 'Hello World' then DoSomething;"

You certainly could use variants, both for the thing you want to search for and for the array, however, even Borland points out that variants are not very effecient. And as you get into them you will find them not easy either. I suggest you would be much better off doing several seperate functions within a single class and using overloaded methods.