import 'package:intl/intl.dart';

/// Created by Haoyi on 2020/6/9

class CurrencyUtils {
  static final coinsFormatter = NumberFormat.currency(locale: "en_US", symbol: "", decimalDigits: 0);

  static String formatCoins(num price) {
    return coinsFormatter.format(price);
  }

  static String toW(num price) {
    if (price < 10000) {
      return formatCoins(price);
    }
    var numberFormat = NumberFormat.compact(locale: "en_US");
    return numberFormat.format(price);
  }
}
