Xojo Developer Conference
Join us from 25th to 27th April 2018 in Denver.

Platforms to show: All Mac Windows Linux Cross-Platform

FAQ.How to format double with n digits?
Feedback.

Answer: You can use the FormatMBS function for this.
Example:
dim d as Double = 123.4567890
listbox1.AddRow FormatMBS("%f", d)
listbox1.AddRow FormatMBS("%e", d)
listbox1.AddRow FormatMBS("%g", d)

listbox1.AddRow FormatMBS("%5.5f", d)
listbox1.AddRow FormatMBS("%5.5e", d)
listbox1.AddRow FormatMBS("%5.5g", d)

d = 0.000000123456
listbox1.AddRow FormatMBS("%f", d)
listbox1.AddRow FormatMBS("%e", d)
listbox1.AddRow FormatMBS("%g", d)

listbox1.AddRow FormatMBS("%5.5f", d)
listbox1.AddRow FormatMBS("%5.5e", d)
listbox1.AddRow FormatMBS("%5.5g", d)
Notes:
see FormatMBS for details.
In general %f is normal style, %e is scientific and %g is whichever gives best result for given space.




Links
MBS FileMaker Plugins