Java Zero Format zeroToSpace(String s)

Here you can find the source of zeroToSpace(String s)

Description

zero To Space

License

Open Source License

Declaration

public static String zeroToSpace(String s) 

Method Source Code

//package com.java2s;

public class Main {

    public static String zeroToSpace(String s) {
        boolean allZero = true;

        if (s == null) {
            return "";
        }//from  w  ww .  j a  v  a  2 s  .  c  o m
        s = s.trim();
        if (s.equals("")) {
            return "";
        }

        // check if the string consist of "0"
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == '0') {
                continue;
            } else {
                allZero = false;
                break;
            }
        }

        // result deal
        if (allZero == true) {
            return "";
        } else {
            return s;
        }
    }
}

Related

  1. zeroString(int value)
  2. zeroSupply(String value, int len)
  3. zeroThrough(int max)
  4. zeroToOne(float value, float min, float max)
  5. zeroToOne(long _min, long _max, long _value)
  6. zeroToStr(String fStr, String lStr)
  7. zeroUnPad(String s)
  8. zeroUnPad(String s)