toShortString method

String toShortString()

Converts the double to a string, omitting decimal places if it's an integer.

Implementation

String toShortString() {
  if (this % 1 == 0) {
    return toInt().toString();
  } else {
    return toString();
  }
}