I've added some new routines to the "Convert.bas" module which will now allow you to convert floating point numbers to strings. The new routines can control the number of digits after the decimal point and also the pad count and pad character before the whole part. For example:
- Code: Select all
sub main()
dim val as double
val = 0.0123456789012345
console.write(Str(val,16),13,10) ' output 0.0123456789012345
console.write(Str(val,3),13,10) ' output 0.012
val = 123.621689
console.write(Str(val,3,5),13,10) ' output 00123.621
console.write(Str(val,6,5,"*"),13,10) ' output **123.621689
end sub
You can download the new BETA from here:
http://www.firewing.info/pmwiki.php?n=Firewing.DownloadThe routines are reasonably accurate and should meet most users needs. Should you wish to improve on the conversion routines, just click on the "Convert" module in the explorer window to view the source code (the routines are at the end of the module).