floatToString static method

String floatToString(
  1. double val, [
  2. int? width
])

Implementation

static String floatToString( double val, [int? width] ){
	String str;
	if( width == null ){
		str = val.toStringAsPrecision( 6 );
	} else {
		if( width < 1 ){
			width = 1;
		}
		if( width > 21 ){
			width = 21;
		}
		str = val.toStringAsPrecision( width );
	}
	return _trimFloatStr( str );
}