@Test public void mainValueTest() { String mainValue = getMainValue("", "ATK".length(), "0"); assertNull(mainValue); mainValue = getMainValue("ATK000001", "ATK".length(), "0"); assertTrue(mainValue != null && 1 == Integer.parseInt(mainValue)); mainValue = getMainValue("ATK000040", "ATK".length(), "0"); assertTrue(mainValue != null && 40 == Integer.parseInt(mainValue)); }
public static String getMainValue(String suppressCode, int headIndex, String needRemoved) { if (!StrUtils.isEmpty(suppressCode)) { String tail = suppressCode.substring(headIndex); while (true) if (tail.startsWith(needRemoved)) tail = tail.substring(1); else return tail; } return null; }
StrUtils { public static String getMainValue(String suppressCode, int headIndex, String needRemoved) { if (!StrUtils.isEmpty(suppressCode)) { String tail = suppressCode.substring(headIndex); while (true) if (tail.startsWith(needRemoved)) tail = tail.substring(1); else return tail; } return null; } }
StrUtils { public static String getMainValue(String suppressCode, int headIndex, String needRemoved) { if (!StrUtils.isEmpty(suppressCode)) { String tail = suppressCode.substring(headIndex); while (true) if (tail.startsWith(needRemoved)) tail = tail.substring(1); else return tail; } return null; } private  StrUtils(); }
StrUtils { public static String getMainValue(String suppressCode, int headIndex, String needRemoved) { if (!StrUtils.isEmpty(suppressCode)) { String tail = suppressCode.substring(headIndex); while (true) if (tail.startsWith(needRemoved)) tail = tail.substring(1); else return tail; } return null; } private  StrUtils(); static String fillWithZero(Number aim, int num); static String getMainValue(String suppressCode, int headIndex, String needRemoved); static boolean isEmpty(final String s); static boolean isNotEmpty(final String s); static boolean isBlank(String s); static boolean isNotBlank(String s); static String cutStartStr(String origin, String start); static String cutMiddleStr(String origin, String middle); static String cutTailStr(String origin, String tail); static LinkedList<String> splitMulti(String origin, final String... separators); static boolean isLike(final String origin, final String aim, final String... ignores); static boolean isNumber(final String s); static String str2Hex(String s); static String hex2Str(String s); static String compression(String s); }
StrUtils { public static String getMainValue(String suppressCode, int headIndex, String needRemoved) { if (!StrUtils.isEmpty(suppressCode)) { String tail = suppressCode.substring(headIndex); while (true) if (tail.startsWith(needRemoved)) tail = tail.substring(1); else return tail; } return null; } private  StrUtils(); static String fillWithZero(Number aim, int num); static String getMainValue(String suppressCode, int headIndex, String needRemoved); static boolean isEmpty(final String s); static boolean isNotEmpty(final String s); static boolean isBlank(String s); static boolean isNotBlank(String s); static String cutStartStr(String origin, String start); static String cutMiddleStr(String origin, String middle); static String cutTailStr(String origin, String tail); static LinkedList<String> splitMulti(String origin, final String... separators); static boolean isLike(final String origin, final String aim, final String... ignores); static boolean isNumber(final String s); static String str2Hex(String s); static String hex2Str(String s); static String compression(String s); static final String ZERO; static final String HEX; static final String COLON; static final String COMMA; static final String DOUBLE_TRANSFER; static final String PLUS; static final String MINUS; static final char POINT; static final String NEXT_LINE; }