StringUtils (D ~ F)
<T extends CharSequence>T defaultIfBlank(T str, T defaultStr)
문자열이 공백, "", null 일 경우 반환할 문자열(defaultStr) 반환
StringUtils.defaultIfBlank(null, "NULL") = "NULL"
StringUtils.defaultIfBlank("", "NULL") = "NULL"
StringUtils.defaultIfBlank(" ", "NULL") = "NULL"
StringUtils.defaultIfBlank("bat", "NULL") = "bat"
StringUtils.defaultIfBlank("", null) = null
|
cs |
<T extends CharSequence>T defaultIfEmpty(T str, T defaultStr)
문자열이 "", null 일 경우 반환할 문자열(defaultStr) 반환
StringUtils.defaultIfEmpty(null, "NULL") = "NULL"
StringUtils.defaultIfEmpty("", "NULL") = "NULL"
StringUtils.defaultIfEmpty(" ", "NULL") = " "
StringUtils.defaultIfEmpty("bat", "NULL") = "bat"
StringUtils.defaultIfEmpty("", null) = null
|
cs |
String defaultString(String str)
문자열이 null 인 경우 공백 반환
StringUtils.defaultString(null) = ""
StringUtils.defaultString("") = ""
StringUtils.defaultString("bat") = "bat"
|
cs |
String defaultString(String str, String defaultStr)
문자열이 null 인 경우 반환할 문자열(defaultStr) 반환
StringUtils.defaultString(null, "NULL") = "NULL"
StringUtils.defaultString("", "NULL") = ""
StringUtils.defaultString("bat", "NULL") = "bat"
|
cs |
String deleteWhitespace(String str)
문자열에 공백이 있으면 제거
StringUtils.deleteWhitespace(null) = null
StringUtils.deleteWhitespace("") = ""
StringUtils.deleteWhitespace("abc") = "abc"
StringUtils.deleteWhitespace(" ab c ") = "abc"
|
cs |
String difference(String str1, String str2)
두 문자열을 비교하여 다른 부분을 반환
StringUtils.difference(null, null) = null
StringUtils.difference("", "") = ""
StringUtils.difference("", "abc") = "abc"
StringUtils.difference("abc", "") = ""
StringUtils.difference("abc", "abc") = ""
StringUtils.difference("abc", "ab") = ""
StringUtils.difference("ab", "abxyz") = "xyz"
StringUtils.difference("abcde", "abxyz") = "xyz"
StringUtils.difference("abcde", "xyz") = "xyz"
|
cs |
boolean endsWith(CharSequence str, CharSequence suffix)
문자열이 마지막 문자열(suffix)로 끝나는지 확인
StringUtils.endsWith(null, null) = true
StringUtils.endsWith(null, "def") = false
StringUtils.endsWith("abcdef", null) = false
StringUtils.endsWith("abcdef", "def") = true
StringUtils.endsWith("ABCDEF", "def") = false
StringUtils.endsWith("ABCDEF", "cde") = false
StringUtils.endsWith("ABCDEF", "") = true
|
cs |
boolean endsWithAny(CharSequence sequence, CharSequence... searchStrings)
문자열이 마지막 문자열(suffix)로 끝나는지 확인(마지막 문자열이 여러가지가 될 수 있음)
StringUtils.endsWithAny(null, null) = false
StringUtils.endsWithAny(null, new String[] {"abc"}) = false
StringUtils.endsWithAny("abcxyz", null) = false
StringUtils.endsWithAny("abcxyz", new String[] {""}) = true
StringUtils.endsWithAny("abcxyz", new String[] {"xyz"}) = true
StringUtils.endsWithAny("abcxyz", new String[] {null, "xyz", "abc"}) = true
StringUtils.endsWithAny("abcXYZ", "def", "XYZ") = true
StringUtils.endsWithAny("abcXYZ", "def", "xyz") = false
|
cs |
boolean endsWithIgnoreCase(CharSequence str, CharSequence suffix)
문자열이 마지막 문자열(suffix)로 끝나는지 확인(대소문자 구별 안함)
StringUtils.endsWithIgnoreCase(null, null) = true
StringUtils.endsWithIgnoreCase(null, "def") = false
StringUtils.endsWithIgnoreCase("abcdef", null) = false
StringUtils.endsWithIgnoreCase("abcdef", "def") = true
StringUtils.endsWithIgnoreCase("ABCDEF", "def") = true
StringUtils.endsWithIgnoreCase("ABCDEF", "cde") = false
|
cs |
boolean equals(CharSequence cs1, CharSequence cs2)
두 문자열이 같은지 비교
StringUtils.equals(null, null) = true
StringUtils.equals(null, "abc") = false
StringUtils.equals("abc", null) = false
StringUtils.equals("abc", "abc") = true
StringUtils.equals("abc", "ABC") = false
|
cs |
boolean equalsAny(CharSequence string, CharSequence... searchStrings)
두 문자열이 같은지 비교(비교 문자열이 여러가지가 될 수 있음)
StringUtils.equalsAny(null, (CharSequence[]) null) = false
StringUtils.equalsAny(null, null, null) = true
StringUtils.equalsAny(null, "abc", "def") = false
StringUtils.equalsAny("abc", null, "def") = false
StringUtils.equalsAny("abc", "abc", "def") = true
StringUtils.equalsAny("abc", "ABC", "DEF") = false
|
cs |
boolean equalsAnyIgnoreCase(CharSequence string, CharSequence... searchStrings)
두 문자열이 같은지 비교(비교 문자열이 여러가지가 될 수 있음, 대소문자 구별 안함)
StringUtils.equalsAnyIgnoreCase(null, (CharSequence[]) null) = false
StringUtils.equalsAnyIgnoreCase(null, null, null) = true
StringUtils.equalsAnyIgnoreCase(null, "abc", "def") = false
StringUtils.equalsAnyIgnoreCase("abc", null, "def") = false
StringUtils.equalsAnyIgnoreCase("abc", "abc", "def") = true
StringUtils.equalsAnyIgnoreCase("abc", "ABC", "DEF") = true
|
cs |
boolean equalsIgnoreCase(CharSequence str1, CharSequence str2)
두 문자열이 같은지 비교(대소문자 구별 안함)
StringUtils.equalsIgnoreCase(null, null) = true
StringUtils.equalsIgnoreCase(null, "abc") = false
StringUtils.equalsIgnoreCase("abc", null) = false
StringUtils.equalsIgnoreCase("abc", "abc") = true
StringUtils.equalsIgnoreCase("abc", "ABC") = true
|
cs |
<T extends CharSequence>T firstNonBlank(T... values)
공백, "", null 을 제외한 첫번째 문자열 반환
StringUtils.firstNonBlank(null, null, null) = null
StringUtils.firstNonBlank(null, "", " ") = null
StringUtils.firstNonBlank("abc") = "abc"
StringUtils.firstNonBlank(null, "xyz") = "xyz"
StringUtils.firstNonBlank(null, "", " ", "xyz") = "xyz"
StringUtils.firstNonBlank(null, "xyz", "abc") = "xyz"
StringUtils.firstNonBlank() = null
|
cs |
<T extends CharSequence>T firstNonEmpty(T... values)
공백을 제외한 첫번째 문자열 반환
StringUtils.firstNonEmpty(null, null, null) = null
StringUtils.firstNonEmpty(null, null, "") = null
StringUtils.firstNonEmpty(null, "", " ") = " "
StringUtils.firstNonEmpty("abc") = "abc"
StringUtils.firstNonEmpty(null, "xyz") = "xyz"
StringUtils.firstNonEmpty("", "xyz") = "xyz"
StringUtils.firstNonEmpty(null, "xyz", "abc") = "xyz"
StringUtils.firstNonEmpty() = null
|
cs |