EgovStringUtil { public static String lPad(String str, int len, char pad) { return lPad(str, len, pad, false); } private  EgovStringUtil(); static boolean isNull(String str); static boolean isAlpha(String str); static boolean isAlphaNumeric(String str); static String integer2string(int integer); static String long2string(long longdata); static String float2string(float floatdata); static String double2string(double doubledata); static String null2void(String str); static int string2integer(String str); static float string2float(String str); static double string2double(String str); static long string2long(String str); static String null2string(String str, String defaultValue); static int string2integer(String str, int defaultValue); static float string2float(String str, float defaultValue); static double string2double(String str, double defaultValue); static long string2long(String str, long defaultValue); static boolean equals(String source, String target); static String toSubString(String str, int beginIndex, int endIndex); static String toSubString(String source, int beginIndex); static int search(String source, String target); static String trim(String str); static String ltrim(String str); static String rtrim(String str); static String concat(String str1, String str2); static String lPad(String str, int len, char pad); static String lPad(String str, int len, char pad, boolean isTrim); static String rPad(String str, int len, char pad); static String rPad(String str, int len, char pad, boolean isTrim); static String alignLeft(String str, int length); static String alignLeft(String str, int length, boolean isEllipsis); static String alignRight(String str, int length); static String alignRight(String str, int length, boolean isEllipsis); static String alignCenter(String str, int length); static String alignCenter(String str, int length, boolean isEllipsis); static String capitalize(String str); static boolean isPatternMatch(String str, String pattern); static String toEng(String kor); static String toKor(String en); static int countOf(String str, String charToFind); static String encodePassword(String password, String algorithm); @SuppressWarnings("restriction") @Deprecated static String encodeString(String str); @SuppressWarnings("restriction") @Deprecated static String decodeString(String str); static String swapFirstLetterCase(String str); static String trim(String origString, String trimString); static String getLastString(String origStr, String strToken); static String[] getStringArray(String str, String strToken); static boolean isNotEmpty(String str); static boolean isEmpty(String str); static String replace(String str, String replacedStr, String replaceStr); static boolean isPatternMatching(String str, String pattern); static boolean containsMaxSequence(String str, String maxSeqNumber); static boolean containsInvalidChars(String str, char[] invalidChars); static boolean containsInvalidChars(String str, String invalidChars); static boolean isNumeric(String str); static String reverse(String str); static String fillString(String originalStr, char ch, int cipers); static final boolean isEmptyTrimmed(String foo); static List<String> getTokens(String lst, String separator); static List<?> getTokens(String lst); static String convertToCamelCase(String targetString, char posChar); static String convertToCamelCase(String underScore); static String convertToUnderScore(String camelCase);  }
@Test public void testLPad() throws Exception { String source = "test "; int i = 10; char c = 'a'; String result = EgovStringUtil.lPad(source, i, c); assertEquals("aaaaatest ", result); result = EgovStringUtil.lPad(source, i, c, true); assertEquals("aaaaaatest", result); source = " test"; result = EgovStringUtil.rPad(source, i, c); assertEquals(" testaaaaa", result); result = EgovStringUtil.rPad(source, i, c, true); assertEquals("testaaaaaa", result); }