convertPrice static method

String convertPrice(
  1. int price
)

Implementation

static String convertPrice(int price) {
  String result = (price / 100).toString();
  //如果小数点后只有1位,且为 0
  if (result.endsWith('.0')) {
    return result.substring(0, result.lastIndexOf('.'));
  }
  return result;
}