mirrored_repositories/Flutter_Hacktoberfest_2021/flutter_calc
class NumberFormatter {
  static String format(String text) {
    try {
      double parsedNumber = double.parse(text);

      if ((parsedNumber != double.infinity) && (parsedNumber == parsedNumber.floor())) {
        return parsedNumber.truncate().toString();
      }

      return text;
    } catch(err) {
      return text;
    }
  }
}
