[Gambas-user] Need help on format$ function

Christian Faure christian.faurebouvard at ...357...
Sat Nov 27 15:53:34 CET 2004


El Viernes, 26 de Noviembre de 2004 16:14, Bodard Fabien escribió:
> 12355.20
Hi,
i think format() not support requested format,
divide into its components:

PUBLIC FUNCTION format_hl(x AS Variant ) AS String 
  DIM hl AS Variant 
  DIM l AS Variant 
  DIM cl AS Variant 
  DIM out AS String 
  
  x=Round(x,-2)
  hl=Int(x/100)
  l=Int(x-hl*100)
  cl = Frac(x)*100

  out=Format(hl,"#,##0hl") 'hl
  out=out &" " & Format(l,"#,##0l") 'l
  out=out &" " & Format(cl,"00cl") 'cl
  RETURN out  
END

PUBLIC SUB Button1_Click()
  PRINT format_hl(12355.999)
END







More information about the User mailing list