withUnit static method
with unit. 拼接单位.
Exhaustive switch expression over MoneyUnit — adding a new enum value will produce a compile-time error here instead of silently falling through.
Implementation
static String withUnit(String moneyTxt, MoneyUnit unit) {
return switch (unit) {
MoneyUnit.NORMAL => moneyTxt,
MoneyUnit.YUAN => YUAN + moneyTxt,
MoneyUnit.YUAN_ZH => moneyTxt + YUAN_ZH,
MoneyUnit.DOLLAR => DOLLAR + moneyTxt,
};
}