


  function fmt(string sf,...) as string
  '====================================
  sys     p=@param+sizeof sys
  sys     nv at p 'integers
  bstring sv at p 'string
  single  fv at p 'single
  double  dv at p 'double
  sys i
  int le=len sf
  string sp="  "
  do
    i++ : if i>le then exit do
    select asc sf,i
    case "s" : function+= sv sp : p+=sizeof sys
    case "n" : function+= nv sp : p+=sizeof sys
    case "f" : function+= fv sp : p+=sizeof sys
    case "d" : function+= dv sp : p+=sizeof double
    end select
  end do
  end function


  'TEST
  '====

  'literal floating points are Double
  
  string s

  's=fmt "" 'tolerates empty ellipsis
  'print len s
   s=fmt ("sndd","Result:", 42, 1.25, pi)
  print s


