Android examples for java.lang:String Strip
strip string from Start
import java.io.UnsupportedEncodingException; import java.math.BigDecimal; import java.security.SecureRandom; import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.Locale; public class Main{ /**/*from w ww. j a va2 s . c o m*/ * * <pre> * StringUtil.stripStart(null, *) = null * StringUtil.stripStart("", *) = "" * StringUtil.stripStart("abc", "") = "abc" * StringUtil.stripStart("abc", null) = "abc" * StringUtil.stripStart(" abc", null) = "abc" * StringUtil.stripStart("abc ", null) = "abc " * StringUtil.stripStart(" abc ", null) = "abc " * StringUtil.stripStart("yxabc ", "xyz") = "abc " * </pre> */ public static String stripStart(String str, String stripChars) { int strLen; if (str == null || (strLen = str.length()) == 0) { return str; } int start = 0; if (stripChars == null) { while ((start != strLen) && Character.isWhitespace(str.charAt(start))) { start++; } } else if (stripChars.length() == 0) { return str; } else { while ((start != strLen) && (stripChars.indexOf(str.charAt(start)) != -1)) { start++; } } return str.substring(start); } }