截取字符串(去掉前n个字符)

 

public static String truncateHeadString(String origin, int count) {
    if (origin == null || origin.length() < count) {
        return null;
    }
    char[] arr = origin.toCharArray();
    char[] ret = new char[arr.length - count];
    for (int i = 0; i < ret.length; i++) {
        ret[i] = arr[i + count];
    }
    return String.copyValueOf(ret);
}

参数含义:

        origin:要操作的字符串

        count:去掉字符串的数量

你可能感兴趣的:(android,java,utils)