volavy
asked on
How can I make a function return more than one value ?
I would like my function to return more than one string. Let's say I feed the function with a string, and then it returns eg. my first and my second name. How do I syntax the function?
/Peter
/Peter
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I'm sorry, I'm dreaming.
You can define your own type like this:
type
resulttype = record
FirstName: String
SecondName: String
end;
...
function SplitName(Name: String): resulttype;
var
Name1, Name2: String;
begin
....
result.^FirstName := Name1;
result.^SecondName := Name2;
end;
Another Way is to use a procedure by using parameters by reference.
You can use a TList or aTStringlist object as functiunresult.
and many many more.