Here you can find the source of zeroToSpace(String s)
public static String zeroToSpace(String s)
//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; } } }