Hi all,
 
Further to my enpty string question, I'm writing a lot of
functions that return a set of strings joined by a separator
ie 'col1, col2,...' or 'col1 = 'a' and colb = 'b'' (as you may guess
these are all parts of SQL Statements)
 
given a function 'Itemcount' that returns the number of items
and item(i) that returns the item string, and function sep what is the
best form of such a function
 
to seed the duscussion I'll give you one of my variants
 
function statement: string;
var
  I: integer;
begin
  Result := '';
  for I := 0 to pred(ItemCount) do
    if I = 0 then Result := Item(I)
    else Result := format('%s%s%s',[Result,Sep,Item(I)])
end;
 
Variants and explainations pls
 
Neven
 

Reply via email to