Syd&Sandy wrote: > Hi all , is there a way to format a double and output that to a > string property with writing the double to a property first . Should > be doable but it escapes me at the moment ... > > Example : (double) 2.30 to (string) 2:30
Nasal numbers will convert directly to strings according to fairly standard representations. Just use them directly, no conversion is neccessary: var val = 2.3; var msg = "The value of 'val' is: " ~ val; If you need fancy formatting, like for example limiting the output precision, there is a sprintf() function available that works just like the ANSI one: var msg = sprintf("The value of 'val' is: %.2f", val); I'm not sure if the colon in "2:30" is a typo or not, but that's possible too with a bit of work: var frac = math.mod(val, 1); sprintf("Formatted: %d:%2.2d", val-frac, 100*frac); Andy ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel