Java String Unpad unpadZeroString(String string)

Here you can find the source of unpadZeroString(String string)

Description

unpad Zero String

License

LGPL

Declaration

public static final String unpadZeroString(String string) 

Method Source Code

//package com.java2s;
/**//from   w  ww  .j a  v a2 s.  co m
 * Converts a line of text into an array of lower case words using a
 * BreakIterator.wordInstance(). <p>
 *
 * This method is under the Jive Open Source Software License and was
 * written by Mark Imbriaco.
 *
 * @param text a String of text to convert into an array of words
 * @return text broken up into an array of words.
 */

public class Main {
    private static final char[] zeroArray = "0000000000000000".toCharArray();

    public static final String unpadZeroString(String string) {
        if (string == null) {
            return string;
        }
        StringBuffer buf = new StringBuffer(string);
        while (buf.charAt(0) == zeroArray[0]) {
            buf = buf.deleteCharAt(0);
        }
        //buf.substring(,string.length()-1);
        return buf.toString();
    }
}

Related

  1. unPad(byte[] bytes)
  2. unPad(byte[] src, int start, byte[] dest)
  3. unPadLeft(String s, char c)
  4. unPadRight(String s, char c)