withUnit static method

String withUnit(
  1. String moneyTxt,
  2. MoneyUnit unit
)

with unit. 拼接单位. 输出价格

Implementation

static String withUnit(String moneyTxt, MoneyUnit unit) {
  switch (unit) {
    case MoneyUnit.yuan:
      moneyTxt = yuan + moneyTxt;
      break;
    case MoneyUnit.yuanZh:
      moneyTxt = moneyTxt + yuanZh;
      break;
    case MoneyUnit.dollar:
      moneyTxt = dollar + moneyTxt;
      break;
    default:
      break;
  }
  return moneyTxt;
}