Java Money moneyFenToYuan(String amount)

Here you can find the source of moneyFenToYuan(String amount)

Description

money Fen To Yuan

License

Open Source License

Declaration

public static String moneyFenToYuan(String amount) 

Method Source Code

//package com.java2s;

public class Main {

    public static String moneyFenToYuan(String amount) {
        if (isEmpty(amount)) {
            return amount;
        }//from w  w w  . ja  v  a 2 s.c  o  m
        if (amount.indexOf(".") > -1) {
            return amount;
        }
        if (amount.length() == 1) {
            return "0.0" + amount;
        } else if (amount.length() == 2) {
            return "0." + amount;
        } else {
            return amount.substring(0, amount.length() - 2) + "." + amount.substring(amount.length() - 2);
        }
    }

    public static boolean isEmpty(String input) {
        return null == input || 0 == input.length() || 0 == input.replaceAll("\\s", "").length();
    }

    public static boolean isEmpty(byte[] bytes) {
        return null == bytes || 0 == bytes.length;
    }
}

Related

  1. isMoney(String money)
  2. isMoney(String money)
  3. isMoney(String str)
  4. isMoney(String[] Moneys, String key)
  5. moneyChange(String money)
  6. moneyMinus(float a, float b)
  7. multiMoney(Integer money)
  8. string2Money(String money)
  9. translateMoneyStr(String money)