Constant DELIMITER=","
Constant DELIMITER=","
Capitalizes a String changing the first letter to title case as per
Character#toTitleCase(char)
.
Capitalizes a String changing the first letter to title case as per
Character#toTitleCase(char)
. No other letters are changed.
For a word based algorithm, see returns null
.
capitalize(null) = null capitalize("") = "" capitalize("cat") = "Cat" capitalize("cAt") = "CAt"
the String to capitalize, may be null
the capitalized String, null
if null String input
2.0
#uncapitalize(String)
concat.
concat.
a java.lang.String
object.
a java.lang.String
object.
Checks if CharSequence contains a search character, handling null
.
Checks if CharSequence contains a search character, handling null
. This method uses
String#indexOf(int)
if possible.
A null
or empty ("") CharSequence will return false
.
contains(null, *) = false contains("", *) = false contains("abc", 'a') = true contains("abc", 'z') = false
the CharSequence to check, may be null
the character to find
true if the CharSequence contains the search character,
false if not or null
string input
2.0
Checks if CharSequence contains a search CharSequence, handling null
.
Checks if CharSequence contains a search CharSequence, handling null
. This method uses
String#indexOf(String)
if possible.
A null
CharSequence will return false
.
contains(null, *) = false contains(*, null) = false contains("", "") = true contains("abc", "") = true contains("abc", "a") = true contains("abc", "z") = false
the CharSequence to check, may be null
the CharSequence to find, may be null
true if the CharSequence contains the search CharSequence,
false if not or null
string input
count inner string in host string
count inner string in host string
a java.lang.String
object.
a java.lang.String
object.
a int.
count char in host string
count char in host string
java.lang.String
object.
a char.
a int.
Returns either the passed in CharSequence, or if the CharSequence is whitespace, empty ("") or
null
, the value of defaultStr
.
Returns either the passed in CharSequence, or if the CharSequence is whitespace, empty ("") or
null
, the value of defaultStr
.
replace [bigen,end] [1...end] with givenStr 可以使用StringBuilder的replace方法替换该方法
replace [bigen,end] [1...end] with givenStr 可以使用StringBuilder的replace方法替换该方法
a java.lang.String
object.
a java.lang.String
object.
a int.
a int.
a java.lang.String
object.
insert.
insert.
a java.lang.String
object.
a java.lang.String
object.
a int.
a java.lang.String
object.
返回一个新的逗号相隔字符串,实现其中的单词a-b的功能
返回一个新的逗号相隔字符串,实现其中的单词a-b的功能
a java.lang.String
object.
a java.lang.String
object.
a java.lang.String
object.
a java.lang.String
object.
intersectSeq.
intersectSeq.
a java.lang.String
object.
a java.lang.String
object.
a java.lang.String
object.
Checks if a CharSequence is whitespace, empty ("") or null.
Checks if a CharSequence is whitespace, empty ("") or null.
isBlank(null) = true isBlank("") = true isBlank(" ") = true isBlank("bob") = false isBlank(" bob ") = false
the CharSequence to check, may be null
true
if the CharSequence is null, empty or whitespace
3.0
Returns true is cs is null or cs.length equals 0.
Returns true is cs is null or cs.length equals 0.
判断两个","逗号相隔的字符串中的单词是否完全等同.
判断两个","逗号相隔的字符串中的单词是否完全等同.
a java.lang.String
object.
a java.lang.String
object.
a java.lang.String
object.
a boolean.
isEqualSeq.
isEqualSeq.
not null
not null
a boolean.
Checks if a CharSequence is not empty (""), not null and not whitespace only.
Checks if a CharSequence is not empty (""), not null and not whitespace only.
isNotBlank(null) = false isNotBlank("") = false isNotBlank(" ") = false isNotBlank("bob") = true isNotBlank(" bob ") = true
the CharSequence to check, may be null
true
if the CharSequence is not empty and not null and not whitespace
3.0
Return true if cs not null and cs has length.
Return true if cs not null and cs has length.
将数组中的字符串,用delimiter串接起来.
首尾不加delimiter
将数组中的字符串,用delimiter串接起来.
首尾不加delimiter
an array of java.lang.String
objects.
a java.lang.String
object.
a java.lang.String
object.
join.
join.
a java.lang.String
object.
a java.lang.String
object.
join.
join.
a java.lang.String
object.
a java.lang.String
object.
保持逗号分隔的各个单词都是唯一的。并且按照原来的顺序存放。
保持逗号分隔的各个单词都是唯一的。并且按照原来的顺序存放。
a java.lang.String
object.
Left pad a String with a specified character.
Left pad a String with a specified character.
Pad to a size of size
.
leftPad(null, *, *) = null leftPad("", 3, 'z') = "zzz" leftPad("bat", 3, 'z') = "bat" leftPad("bat", 5, 'z') = "zzbat" leftPad("bat", 1, 'z') = "bat" leftPad("bat", -1, 'z') = "bat"
the String to pad out, may be null
the size to pad to
the character to pad with
left padded String or original String if no padding is necessary, null
if null
String input
3.0
将两个用delimiter串起来的字符串,合并成新的串,重复的"单词"只出现一次.
将两个用delimiter串起来的字符串,合并成新的串,重复的"单词"只出现一次.
如果第一个字符串以delimiter开头,第二个字符串以delimiter结尾,
合并后的字符串仍以delimiter开头和结尾.
mergeSeq(",1,2,", "") = ",1,2,"; mergeSeq(",1,2,", null) = ",1,2,"; mergeSeq("1,2", "3") = "1,2,3"; mergeSeq("1,2", "3,") = "1,2,3,"; mergeSeq(",1,2", "3,") = ",1,2,3,"; mergeSeq(",1,2,", ",3,") = ",1,2,3,";
a java.lang.String
object.
a java.lang.String
object.
a java.lang.String
object.
a java.lang.String
object.
mergeSeq.
mergeSeq.
a java.lang.String
object.
a java.lang.String
object.
a java.lang.String
object.
Removes all occurrences of a character from within the source string.
Removes all occurrences of a character from within the source string.
A null
source string will return null
. An empty ("") source string will return
the empty string.
StringUtils.remove(null, *) = null StringUtils.remove("", *) = "" StringUtils.remove("queued", 'u') = "qeed" StringUtils.remove("queued", 'z') = "queued"
the source String to search, may be null
the char to search for and remove, may be null
the substring with the char removed if found, null
if null String input
removeWord.
removeWord.
a java.lang.String
object.
a java.lang.String
object.
a java.lang.String
object.
a java.lang.String
object.
removeWord.
removeWord.
a java.lang.String
object.
a java.lang.String
object.
a java.lang.String
object.
Repeat a String repeat
times to form a new String.
Repeat a String repeat
times to form a new String.
repeat(null, 2) = null repeat("", 0) = "" repeat("", 2) = "" repeat("a", 3) = "aaa" repeat("ab", 2) = "abab" repeat("a", -2) = ""
the String to repeat, may be null
number of times to repeat str, negative treated as zero
a new String consisting of the original String repeated, null
if null String
input
3.0
Returns padding using the specified delimiter repeated to a given length.
Returns padding using the specified delimiter repeated to a given length.
repeat(0, 'e') = "" repeat(3, 'e') = "eee" repeat(-2, 'e') = ""
character to repeat
number of times to repeat char, negative treated as zero
String with repeated character
#repeat(String, int)
Replaces all occurrences of a String within another String.
Replaces all occurrences of a String within another String.
A null
reference passed to this method is a no-op.
replace(null, *, *) = null replace("", *, *) = "" replace("any", null, *) = "any" replace("any", *, null) = "any" replace("any", "", *) = "any" replace("aba", "a", null) = "aba" replace("aba", "a", "") = "b" replace("aba", "a", "z") = "zbz"
text to search and replace in, may be null
the String to search for, may be null
the String to replace it with, may be null
the text with any replacements processed, null
if null String input
Right pad a String with a specified character.
Right pad a String with a specified character.
The String is padded to the size of size
.
rightPad(null, *, *) = null rightPad("", 3, 'z') = "zzz" rightPad("bat", 3, 'z') = "bat" rightPad("bat", 5, 'z') = "batzz" rightPad("bat", 1, 'z') = "bat" rightPad("bat", -1, 'z') = "bat"
the String to pad out, may be null
the size to pad to
the character to pad with
right padded String or original String if no padding is necessary, null
if null
String input
3.0
Splits the provided text into an array, separators specified.
Splits the provided text into an array, separators specified. This is an alternative to using
StringTokenizer.
A null
input String returns null
. A null
separatorChars splits on
whitespace.
split(null, *) = null split("", *) = [] split("abc def", null) = ["abc", "def"] split("abc def", " ") = ["abc", "def"] split("abc def", " ") = ["abc", "def"] split("ab:cd:ef", ":") = ["ab", "cd", "ef"]
split with separators
split with separators
a java.lang.String
object.
an array of char.
an array of java.lang.String
objects.
Splits the provided text into an array, separator specified.
Splits the provided text into an array, separator specified. This is an alternative to using
StringTokenizer.
A null
input String returns null
.
split(null, *) = null split("", *) = [] split("a.b.c", '.') = ["a", "b", "c"] split("a..b.c", '.') = ["a", "b", "c"] split("a:b:c", '.') = ["a:b:c"] split("a b c", ' ') = ["a", "b", "c"]
split.
split.
a java.lang.String
object.
an array of java.lang.String
objects.
将1-2,3,4-9之类的序列拆分成数组
将1-2,3,4-9之类的序列拆分成数组
a java.lang.String
object.
an array of Int objects.
splitToInteger.
splitToInteger.
splitToLong.
Strips any of a set of characters from the end of a String.
Strips any of a set of characters from the end of a String.
A null
input String returns null
.
An empty string ("") input returns the empty string.
If the stripChars String is null
, whitespace is
stripped as defined by Character#isWhitespace(char)
.
stripEnd(null, *) = null stripEnd("", *) = "" stripEnd("abc", "") = "abc" stripEnd(*, null) = * stripEnd(" abcyx", "xyz") = " abc"
the String to remove characters from, may be null
the characters to remove, null treated as whitespace
the stripped String, null
if null String input
Gets a substring from the specified String avoiding exceptions.
Gets a substring from the specified String avoiding exceptions.
A negative start position can be used to start/end n
characters from the end of the
String.
The returned substring starts with the character in the start
position and ends before
the end
position. All position counting is zero-based -- i.e., to start at the
beginning of the string use start = 0
. Negative start and end positions can be used to
specify offsets relative to the end of the String.
If start
is not strictly to the left of end
, "" is returned.
substring(null, *, *) = null substring("", * , *) = ""; substring("abc", 0, 2) = "ab" substring("abc", 2, 0) = "" substring("abc", 2, 4) = "c" substring("abc", 4, 6) = "" substring("abc", 2, 2) = "" substring("abc", -2, -1) = "b" substring("abc", -4, 2) = "ab"
the String to get the substring from, may be null
substring from start position to end position, null
if null String input
Gets the substring after the first occurrence of a separator.
Gets the substring after the first occurrence of a separator. The separator is not returned.
A null
string input will return null
. An empty ("") string input will return
the empty string. A null
separator will return the empty string if the input string is
not null
.
If nothing is found, the empty string is returned.
substringAfter(null, *) = null substringAfter("", *) = "" substringAfter(*, null) = "" substringAfter("abc", "a") = "bc" substringAfter("abcba", "b") = "cba" substringAfter("abc", "c") = "" substringAfter("abc", "d") = "" substringAfter("abc", "") = "abc"
the String to get a substring from, may be null
the String to search for, may be null
the substring after the first occurrence of the separator, null
if null String
input
2.0
Gets the substring after the last occurrence of a separator.
Gets the substring after the last occurrence of a separator. The separator is not returned.
A null
string input will return null
. An empty ("") string input will return
the empty string. An empty or null
separator will return the empty string if the input
string is not null
.
If nothing is found, the empty string is returned.
substringAfterLast(null, *) = null substringAfterLast("", *) = "" substringAfterLast(*, "") = "" substringAfterLast(*, null) = "" substringAfterLast("abc", "a") = "bc" substringAfterLast("abcba", "b") = "a" substringAfterLast("abc", "c") = "" substringAfterLast("a", "a") = "" substringAfterLast("a", "z") = ""
the String to get a substring from, may be null
the String to search for, may be null
the substring after the last occurrence of the separator, null
if null String
input
3.0
Gets the substring before the first occurrence of a separator.
Gets the substring before the first occurrence of a separator. The separator is not returned.
A null
string input will return null
. An empty ("") string input will return
the empty string. A null
separator will return the input string.
If nothing is found, the string input is returned.
substringBefore(null, *) = null substringBefore("", *) = "" substringBefore("abc", "a") = "" substringBefore("abcba", "b") = "a" substringBefore("abc", "c") = "ab" substringBefore("abc", "d") = "abc" substringBefore("abc", "") = "" substringBefore("abc", null) = "abc"
the String to get a substring from, may be null
the String to search for, may be null
the substring before the first occurrence of the separator, null
if null String
input
2.0
Gets the substring before the last occurrence of a separator.
Gets the substring before the last occurrence of a separator. The separator is not returned.
A null
string input will return null
. An empty ("") string input will return
the empty string. An empty or null
separator will return the input string.
If nothing is found, the string input is returned.
substringBeforeLast(null, *) = null substringBeforeLast("", *) = "" substringBeforeLast("abcba", "b") = "abc" substringBeforeLast("abc", "c") = "ab" substringBeforeLast("a", "a") = "" substringBeforeLast("a", "z") = "a" substringBeforeLast("a", null) = "a" substringBeforeLast("a", "") = "a"
the String to get a substring from, may be null
the String to search for, may be null
the substring before the last occurrence of the separator, null
if null String
input
3.0
Gets the String that is nested in between two Strings.
Gets the String that is nested in between two Strings. Only the first match is returned.
A null
input String returns null
. A null
open/close returns
null
(no match). An empty ("") open and close returns an empty string.
substringBetween("wx[b]yz", "[", "]") = "b" substringBetween(null, *, *) = null substringBetween(*, null, *) = null substringBetween(*, *, null) = null substringBetween("", "", "") = "" substringBetween("", "", "]") = null substringBetween("", "[", "]") = null substringBetween("yabcz", "", "") = "" substringBetween("yabcz", "y", "z") = "abc" substringBetween("yabczyabcz", "y", "z") = "abc"
the String containing the substring, may be null
the String before the substring, may be null
the String after the substring, may be null
the substring, null
if no match
3.0
返回一个新的逗号相隔字符串,实现其中的单词a-b的功能.
返回一个新的逗号相隔字符串,实现其中的单词a-b的功能. 新的字符串将以,开始,结束
subtractSeq.
subtractSeq.
a java.lang.String
object.
a java.lang.String
object.
a java.lang.String
object.
transformToInt.
transformToInt.
an array of java.lang.String
objects.
an array of java.lang.Integer
objects.
transformToJLong.
transformToJLong.
an array of java.lang.String
objects.
an array of java.lang.Long
objects.
Removes control characters (char <= 32) from both ends of this String, handling null
by returning null
.
Removes control characters (char <= 32) from both ends of this String, handling null
by returning null
.
The String is trimmed using String#trim()
. Trim removes start and end characters <=
32.
trim(null) = null trim("") = "" trim(" ") = "" trim("abc") = "abc" trim(" abc ") = "abc"
the String to be trimmed, may be null
the trimmed string, null
if null String input
3.0
将驼峰表示法转换为下划线小写表示
将驼峰表示法转换为下划线小写表示
a java.lang.String
object.
a char.
a boolean.
a java.lang.String
object.
unCamel.
unCamel.
a java.lang.String
object.
a char.
a java.lang.String
object.
unCamel.
Uncapitalizes a String changing the first letter to title case as per
Character#toLowerCase(char)
.
Uncapitalizes a String changing the first letter to title case as per
Character#toLowerCase(char)
. No other letters are changed.
For a word based algorithm, see String returns null
.
uncapitalize(null) = null uncapitalize("") = "" uncapitalize("Cat") = "cat" uncapitalize("CAT") = "cAT"
the String to uncapitalize, may be null
the uncapitalized String, null
if null String input
3.0
#capitalize(String)
Operations on
java.lang.String
that arenull
safe.3.0