Android String Strip stripStart(String str, String stripChars)

Here you can find the source of stripStart(String str, String stripChars)

Description

strip Start

Declaration

public static String stripStart(String str, String stripChars) 

Method Source Code

//package com.java2s;

public class Main {

    public static String stripStart(String str, String stripChars) {
        int strLen;
        if (str == null || (strLen = str.length()) == 0) {
            return str;
        }//from   ww  w . j a v a2  s  . c  om
        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);
    }

    public static int indexOf(String str, String searchStr) {
        if (str == null || searchStr == null) {
            return -1;
        }
        return str.indexOf(searchStr);
    }
}

Related

  1. stripCharacters(String inputString, String stripCharacters)
  2. stripControlCharacters(Object value)
  3. stripControlCharacters(String value)
  4. stripEnd(String str, String stripChars)
  5. stripEnd(String str, String stripChars)
  6. stripStart(String str, String stripChars)