package com.yidian.bcommon.utils

import java.text.NumberFormat

object NumberUtils {

  /**
   * 数字格式化
   * 默认保留2位小数
   */
  fun decimalFormat(num: Double, reservedLength: Int = 2): String {
    val nf: NumberFormat = NumberFormat.getNumberInstance()
    nf.maximumFractionDigits = reservedLength
    return nf.format(num)
  }

}
