getRealText function

String getRealText(
  1. double real,
  2. int minimumDecimalCount,
  3. int maximumDecimalCount
)

Implementation

String getRealText(
    double real,
    int minimumDecimalCount,
    int maximumDecimalCount
    )
{
    String realText = real.toStringAsFixed( maximumDecimalCount );

    while ( realText.contains( '.' )
            && ( realText.endsWith( '0' )
                 || realText.endsWith( '.' ) ) )
    {
        realText = realText.substring( 0, realText.length - 1 );
    }

    return realText;
}