{
   This file is part of VirtualBus.
   Copyright 2002-2004 Marcin Kompanowski, Adam Popiołek, Kakish, Maciej Fidor

    VirtualBus is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    VirtualBus is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with VirtualBus; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
}

unit mk_utl;

interface
  function ileparam(str:string):byte;
  function paramnr(str:string;n:byte):string;

implementation
function ileparam(str:string):byte;
var i:byte;
begin
        i:=0;
        while (pos(',',str)>0) do begin delete(str,pos(',',str),1); inc(i); end;
        ileparam:=i;
end;
function paramnr(str:string;n:byte):string;
var i:byte;
begin
{
for i:=1 to n do begin
        ps:=pos(' ',str);
        pp:=pos(',',str);
        if ps=0 then ps:=254;
        if pp=0 then pp:=254;
        delete(str,1,min(ps,pp));
end;}
for i:=1 to n do delete(str,1,pos(',',str));

     //   if pos(',',str)<pos(' ',str) then delete(str,1,pos(',',str)) else delete(str,1,pos(' ',str));


        delete(str,pos(',',str),length(str)-pos(',',str)+1);
   //     delete(str,pos(' ',str),length(str)-pos(' ',str)+1);
        paramnr:=str;
end;

end.
 