Package com.globalmentor.java
Class CharSequences
- java.lang.Object
-
- com.globalmentor.java.CharSequences
-
public class CharSequences extends java.lang.Object
Various text manipulating functions. These methods work on objects that implement theCharSequence
interface. To avoid creation of new strings, some of these methods should be avoided in favor of their correspondingStringBuilders
methods, which operate onStringBuilder
objects.- Author:
- Garret Wilson
- See Also:
StringBuilders
-
-
Constructor Summary
Constructors Constructor Description CharSequences()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static int
charIndexOf(java.lang.CharSequence charSequence, Characters characters)
Deprecated.static int
charIndexOf(java.lang.CharSequence charSequence, Characters characters, int index)
Deprecated.static int
charLastIndexOf(java.lang.CharSequence charSequence, Characters characters)
Deprecated.static int
charLastIndexOf(java.lang.CharSequence charSequence, Characters characters, int index)
Deprecated.static java.lang.CharSequence
checkBounds(java.lang.CharSequence charSequence, int start, int end)
Checks the given bounds of a character sequence.static <T extends java.lang.CharSequence>
TcheckMinLength(T charSequence, int minLength)
Ensures that the given character sequence has a minimum the specified number of characters.static boolean
contains(java.lang.CharSequence charSequence, char character)
Determines if a character sequence contains the given character.static boolean
contains(java.lang.CharSequence charSequence, Characters characters)
Determines if a character sequence contains any of the given characters.static boolean
containsLetter(java.lang.CharSequence charSequence)
Determines if the following character sequence contains a letter.static boolean
containsLetterOrDigit(java.lang.CharSequence charSequence)
Determines if the following character sequence contains a letter or a digit.static boolean
containsNonTrim(java.lang.CharSequence charSequence)
Determines if a character sequence contains characters that are not characters that can be trimmed.static boolean
containsNonWhitespace(java.lang.CharSequence charSequence)
Determines if a character sequence contains characters that are not Unicode whitespace (marked by "WS" in Unicode data).static boolean
containsOnly(java.lang.CharSequence charSequence, Characters characters)
Determines if a character sequence contains only the given characters.static boolean
containsToken(java.lang.CharSequence charSequence, Characters delimiters, java.lang.CharSequence... tokens)
Searches the given character sequence for one of the given tokens, separated by the given delimiters.static boolean
containsTrim(java.lang.CharSequence charSequence)
Determines if a character sequence contains characters that can be trimmed.static boolean
containsWhitespace(java.lang.CharSequence charSequence)
Determines if a character sequence contains Unicode whitespace.static int
count(java.lang.CharSequence charSequence, char character)
Counts the number of occurrences of a particular character in a character sequence.static int
count(java.lang.CharSequence charSequence, char character, int index)
Counts the number of occurrences of a particular character in a character sequence, starting at a specified index and searching forward.static java.lang.CharSequence
denull(java.lang.CharSequence charSequence)
Turns a null character sequence into an empty character sequence.static boolean
endsWith(java.lang.CharSequence charSequence, char character)
Determines if the character sequence ends with the given character.static boolean
endsWith(java.lang.CharSequence charSequence, java.lang.String string)
Determines if the character sequence ends with the given string.static boolean
endsWithIgnoreCase(java.lang.CharSequence charSequence, java.lang.String string)
Determines if the character sequence ends with the given string without case sensitivity.static boolean
equals(java.lang.CharSequence charSequence, char character)
Determines if the given character sequence is composed of the single given character.static boolean
equals(java.lang.CharSequence charSequence1, int start1, int end1, java.lang.CharSequence charSequence2, int start2, int end2)
Compares characters in one character sequence with characters in another character sequence.static boolean
equals(java.lang.CharSequence charSequence1, java.lang.CharSequence charSequence2)
Compares the characters in one character sequence with characters in another character sequence.static boolean
equals(java.lang.CharSequence charSequence1, java.lang.CharSequence charSequence2, int start)
Compares the characters in one character sequence with characters in another character sequence, starting at the given location to the end of the second character sequence.static boolean
equals(java.lang.CharSequence charSequence1, java.lang.CharSequence charSequence2, int start, int end)
Compares the characters in one character sequence with characters in another character sequence.static java.lang.String
escapeHex(java.lang.CharSequence charSequence, Characters validCharacters, Characters invalidCharacters, int maxCharacter, char escapeChar, int escapeLength)
Escapes the indicated characters in the character sequence using the supplied escape character.static java.lang.String
escapeHex(java.lang.CharSequence charSequence, Characters validCharacters, Characters invalidCharacters, int maxCharacter, char escapeChar, int escapeLength, Case hexCase)
Escapes the indicated characters in the character sequence using the supplied escape character.static <S extends java.lang.CharSequence>
SgetStartsWith(java.lang.CharSequence charSequence, int index, java.util.Collection<S> strings)
Determines which if any of the given strings the character sequence starts with, starting at the given index.static <S extends java.lang.CharSequence>
SgetStartsWith(java.lang.CharSequence charSequence, java.util.Collection<S> strings)
Determines which if any of the given strings the character sequence starts with.static java.lang.CharSequence
getToken(java.lang.CharSequence charSequence, Characters delimiters, java.lang.CharSequence... tokens)
Searches the given character sequence for one of the given tokens, separated by the given delimiters.static int
indexNotOf(java.lang.CharSequence charSequence, char character)
Determines the first index not of the given character.static int
indexNotOf(java.lang.CharSequence charSequence, char character, int index)
Determines the first index not of the given character.static int
indexNotOf(java.lang.CharSequence charSequence, Characters characters)
Searches a character sequence and returns the first index of any character not of the given characters, starting at the beginning.static int
indexNotOf(java.lang.CharSequence charSequence, Characters characters, int index)
Searches a character sequence and returns the first index of any character not of the given characters, starting at the given index.static int
indexNotOfLength(java.lang.CharSequence charSequence, char character)
Determines the first index not of the given character.static int
indexNotOfLength(java.lang.CharSequence charSequence, char character, int index)
Determines the first index not of the given character.static int
indexNotOfLength(java.lang.CharSequence charSequence, Characters characters)
Searches a character sequence and returns the first index of any character not of the given characters, starting at the beginning.static int
indexNotOfLength(java.lang.CharSequence charSequence, Characters characters, int index)
Searches a character sequence and returns the first index of any character not of the given characters, starting at the given index.static int
indexOf(java.lang.CharSequence charSequence, char character)
Determines the first index of the given character.static int
indexOf(java.lang.CharSequence charSequence, char character, int index)
Determines the first index of the given character.static int
indexOf(java.lang.CharSequence charSequence, Characters characters)
Searches a character sequence and returns the first index of any character of the given characters, starting at the beginning.static int
indexOf(java.lang.CharSequence charSequence, Characters characters, int index)
Searches a character sequence and returns the first index of any character of the given characters, starting at the given index.static int
indexOfLength(java.lang.CharSequence charSequence, char character)
Determines the first index of the given character.static int
indexOfLength(java.lang.CharSequence charSequence, char character, int index)
Determines the first index of the given character.static int
indexOfLength(java.lang.CharSequence charSequence, Characters characters)
Searches a character sequence and returns the first index of any character of the given characters, starting at the beginning.static int
indexOfLength(java.lang.CharSequence charSequence, Characters characters, int index)
Searches a character sequence and returns the first index of any character of the given characters, starting at the given index.static boolean
isAll(java.lang.CharSequence charSequence, char c)
Determines if the character sequence consists of nothing but the following character.static boolean
isAllChars(java.lang.CharSequence charSequence, Characters characters)
Determines if the character sequence consists of nothing but the given characters.static boolean
isCapitalized(java.lang.CharSequence charSequence)
Determines whether a character sequence is capitalized.static boolean
isDigits(java.lang.CharSequence charSequence)
Determines whether a character sequence contains only Unicode digits.static boolean
isLatinDigits(java.lang.CharSequence charSequence)
Deprecated.Create separateisCharacters()
method and useASCII.DIGIT_CHARACTERS
.static boolean
isLetters(java.lang.CharSequence charSequence)
Determines whether a character sequence contains only Unicode letters.static boolean
isLettersDigits(java.lang.CharSequence charSequence)
Determines whether a character sequence contains only Unicode letters and digits.static boolean
isLettersDigitsCharacters(java.lang.CharSequence charSequence, java.lang.String characters)
Determines whether a character sequence contains only Unicode letters, digits, and the supplied extra characters.static boolean
isNumber(java.lang.CharSequence charSequence)
Determines whether a character sequence contains only numbers and decimals or commas.static boolean
isRomanNumerals(java.lang.CharSequence charSequence)
Determines whether a character sequeence contains only Roman numerals.static boolean
isUpperCase(java.lang.CharSequence charSequence)
Determines whether all the letters in a character sequence are capital letters.static java.lang.CharSequence
join(char delimiter, java.lang.CharSequence... charSequences)
Concatenates the given character sequences, separated by the given delimiter.static java.lang.CharSequence
join(java.lang.CharSequence... charSequences)
Concatenates the given character sequences with no delimiter between them.static int
lastIndexNotOf(java.lang.CharSequence charSequence, char character)
Determines the last index not of the given character.static int
lastIndexNotOf(java.lang.CharSequence charSequence, char character, int index)
Determines the last index not of the given character.static int
lastIndexNotOf(java.lang.CharSequence charSequence, Characters characters)
Searches a character sequence and returns the last index of any character not of the given characters.static int
lastIndexNotOf(java.lang.CharSequence charSequence, Characters characters, int index)
Searches a character sequence and returns the last index of any character not of the given characters, starting at the given index.static int
lastIndexOf(java.lang.CharSequence charSequence, char character)
Determines the last index of the given character.static int
lastIndexOf(java.lang.CharSequence charSequence, char character, int index)
Determines the last index of the given character.static int
lastIndexOf(java.lang.CharSequence charSequence, Characters characters)
Searches a character sequence and returns the last index of any character of the given characters.static int
lastIndexOf(java.lang.CharSequence charSequence, Characters characters, int index)
Searches a character sequence and returns the last index of any character of the given characters, starting at the given index.static java.lang.String
normalizeForSearch(java.lang.CharSequence charSequence)
Normalizes a string so that it can be used as a liberally matching lookup without regard to diacritics or case.static java.lang.String
normalizeForSearch(java.lang.CharSequence charSequence, java.util.Locale locale)
Normalizes a string so that it can be used as a liberally matching lookup without regard to diacritics or case.static int
notCharIndexOf(java.lang.CharSequence charSequence, Characters notCharacters)
Deprecated.static int
notCharIndexOf(java.lang.CharSequence charSequence, Characters notCharacters, int index)
Deprecated.static int
notCharLastIndexOf(java.lang.CharSequence charSequence, Characters notCharacters)
Deprecated.static int
notCharLastIndexOf(java.lang.CharSequence charSequence, Characters notCharacters, int index)
Deprecated.static boolean
notContains(java.lang.CharSequence charSequence, char character)
Determines if a character sequence does not contain the given character.static boolean
notContains(java.lang.CharSequence charSequence, Characters characters)
Determines if a character sequence does not contain any of the given characters.static boolean
notContainsOnly(java.lang.CharSequence charSequence, Characters characters)
Determines if a character sequence does not contain only the given characters.static <CS extends java.lang.CharSequence>
CSnullify(CS charSequence)
Turns an empty character sequence intonull
.static java.lang.String
removeMarks(java.lang.CharSequence charSequence)
Removes all normalized Unicode marks such as accents from a string.static java.lang.CharSequence[]
split(java.lang.CharSequence charSequence, char delimiter)
Deprecated.static boolean
startsWith(java.lang.CharSequence charSequence, char character)
Determines if the character sequence starts with the given character.static boolean
startsWith(java.lang.CharSequence charSequence, int index, java.lang.CharSequence string)
Determines if the character sequence starts with the given string, starting at the given index.static boolean
startsWith(java.lang.CharSequence charSequence, java.lang.CharSequence string)
Determines if the character sequence starts with the given string.static boolean
startsWithChar(java.lang.CharSequence charSequence, Characters characters)
Determines if the character sequence starts with one of the given characters.static char[]
toCharArray(java.lang.CharSequence charSequence)
Returns a character array containing the characters from the given character sequence.static java.lang.CharSequence
truncateAtFirst(java.lang.CharSequence charSequence, char truncateChar)
Truncates the end of the string beginning at the first occurrence of the given character.static java.lang.CharSequence
truncateAtLast(java.lang.CharSequence charSequence, char truncateChar)
Truncates the end of the string beginning at the last occurrence of the given character.static java.lang.CharSequence
unescapeHex(java.lang.CharSequence charSequence, char escapeChar, int escapeLength)
Decodes the escaped characters in the character sequence by converting the hex value after each occurrence of the escape character to the corresponding Unicode character using UTF-8.
-
-
-
Method Detail
-
checkBounds
public static java.lang.CharSequence checkBounds(java.lang.CharSequence charSequence, int start, int end)
Checks the given bounds of a character sequence.- Parameters:
charSequence
- The character sequence against which the bounds should be checked.start
- The start to check, inclusive.end
- The end to check, exclusive.- Returns:
- The given character sequence.
- Throws:
java.lang.StringIndexOutOfBoundsException
- ifstart
orend
is negative or greater thanlength()
, orstart
is greater thanend
.
-
charIndexOf
@Deprecated public static int charIndexOf(java.lang.CharSequence charSequence, Characters characters)
Deprecated.Searches a character sequence and returns the first index of any specified characters, starting at the beginning.- Parameters:
charSequence
- The character sequence to be searched.characters
- The string of characters to check.- Returns:
- The index of the first occurrence of one of the supplied characters, or -1 if none were found.
-
charIndexOf
@Deprecated public static int charIndexOf(java.lang.CharSequence charSequence, Characters characters, int index)
Deprecated.Searches a character sequence and returns the first index of any specified characters, starting at the given index.- Parameters:
charSequence
- The character sequence to be searched.characters
- The string of characters to check.index
- The index to search from.- Returns:
- The index of the first occurrence of one of the supplied characters, or -1 if none were found.
-
charLastIndexOf
@Deprecated public static int charLastIndexOf(java.lang.CharSequence charSequence, Characters characters)
Deprecated.Searches a character sequence in reverse and returns the last index of any specified characters.- Parameters:
charSequence
- The character sequence to be searched.characters
- The string of characters to check.- Returns:
- The index of the last occurrence of one of the supplied characters, or -1 if none were found.
-
charLastIndexOf
@Deprecated public static int charLastIndexOf(java.lang.CharSequence charSequence, Characters characters, int index)
Deprecated.Searches a character sequence in reverse and returns the last index of any specified characters, starting from the given index.- Parameters:
charSequence
- The character sequence to be searched.characters
- The string of characters to check.index
- The index to search from.- Returns:
- The index of the last occurrence of one of the supplied characters, or -1 if none were found.
-
checkMinLength
public static <T extends java.lang.CharSequence> T checkMinLength(T charSequence, int minLength)
Ensures that the given character sequence has a minimum the specified number of characters.- Type Parameters:
T
- The type of character sequence being used.- Parameters:
charSequence
- The character sequence to check.minLength
- The minimum length required.- Returns:
- The given character sequence.
- Throws:
java.lang.NullPointerException
- if the given character sequence isnull
.java.lang.IllegalArgumentException
- if the length of the given character sequence is less than the indicated minimum length.
-
contains
public static boolean contains(java.lang.CharSequence charSequence, char character)
Determines if a character sequence contains the given character.- Parameters:
charSequence
- The character sequence to be searched.character
- The character to check.- Returns:
true
if the given character sequence contains the given character.
-
notContains
public static boolean notContains(java.lang.CharSequence charSequence, char character)
Determines if a character sequence does not contain the given character.- Parameters:
charSequence
- The character sequence to be searched.character
- The character to check.- Returns:
true
if the given character sequence does not contain the given character.
-
contains
public static boolean contains(java.lang.CharSequence charSequence, Characters characters)
Determines if a character sequence contains any of the given characters.- Parameters:
charSequence
- The character sequence to be searched.characters
- The characters to check.- Returns:
true
if the given character sequence contains one of the given characters.
-
notContains
public static boolean notContains(java.lang.CharSequence charSequence, Characters characters)
Determines if a character sequence does not contain any of the given characters.- Parameters:
charSequence
- The character sequence to be searched.characters
- The characters to check.- Returns:
true
if the given character sequence does not contain one of the given characters.
-
containsOnly
public static boolean containsOnly(java.lang.CharSequence charSequence, Characters characters)
Determines if a character sequence contains only the given characters.- Parameters:
charSequence
- The character sequence to be searched.characters
- The characters to check.- Returns:
true
if the given character sequence contains only the given characters.
-
notContainsOnly
public static boolean notContainsOnly(java.lang.CharSequence charSequence, Characters characters)
Determines if a character sequence does not contain only the given characters.- Parameters:
charSequence
- The character sequence to be searched.characters
- The characters to check.- Returns:
true
if the given character sequence does not contain only the given characters.
-
containsLetter
public static boolean containsLetter(java.lang.CharSequence charSequence)
Determines if the following character sequence contains a letter.- Parameters:
charSequence
- The character sequence to search.- Returns:
true
if the sequence has at least one letter.
-
containsLetterOrDigit
public static boolean containsLetterOrDigit(java.lang.CharSequence charSequence)
Determines if the following character sequence contains a letter or a digit.- Parameters:
charSequence
- The character sequence to search.- Returns:
true
if the sequence has at least one letter or digit.- See Also:
Character.isLetterOrDigit(char)
-
containsWhitespace
public static boolean containsWhitespace(java.lang.CharSequence charSequence)
Determines if a character sequence contains Unicode whitespace. Whitespace is denoted by the "WS" bidi class inUnicodeData.txt
. This method does not handle Unicode supplementary characters.- Parameters:
charSequence
- The character sequence to be searched.- Returns:
true
if the given character sequence contains whitespace.- See Also:
Character.isSpaceChar(char)
-
containsNonWhitespace
public static boolean containsNonWhitespace(java.lang.CharSequence charSequence)
Determines if a character sequence contains characters that are not Unicode whitespace (marked by "WS" in Unicode data). Whitespace is denoted by the "WS" bidi class inUnicodeData.txt
. This method does not handle Unicode supplementary characters.- Parameters:
charSequence
- The character sequence to be searched.- Returns:
true
if the given character sequence contains non-whitespace.- See Also:
Character.isSpaceChar(char)
-
containsToken
public static boolean containsToken(java.lang.CharSequence charSequence, Characters delimiters, java.lang.CharSequence... tokens)
Searches the given character sequence for one of the given tokens, separated by the given delimiters.- Parameters:
charSequence
- The character sequence to search.delimiters
- The delimiters to skip.tokens
- The tokens for which to check.- Returns:
- The
true
if one of the given tokens was found. - Throws:
java.lang.NullPointerException
- if the given character sequence, delimiters, and/or tokens isnull
.
-
getToken
public static java.lang.CharSequence getToken(java.lang.CharSequence charSequence, Characters delimiters, java.lang.CharSequence... tokens)
Searches the given character sequence for one of the given tokens, separated by the given delimiters.- Parameters:
charSequence
- The character sequence to search.delimiters
- The delimiters to skip.tokens
- The tokens for which to check.- Returns:
- The token that was found, or
null
if no token was found. - Throws:
java.lang.NullPointerException
- if the given character sequence, delimiters, and/or tokens isnull
.
-
containsTrim
public static boolean containsTrim(java.lang.CharSequence charSequence)
Determines if a character sequence contains characters that can be trimmed. Trimmed characters are denoted by the "WS" (whitespace) bidi class, the "Cc" (control) category, or the "Cf" (format) category inUnicodeData.txt
. This method does not handle Unicode supplementary characters.- Parameters:
charSequence
- The character sequence to be searched.- Returns:
true
if the given character sequence contains trim characters.- See Also:
Character.isSpaceChar(char)
,Character.isISOControl(char)
,Character.getType(char)
-
containsNonTrim
public static boolean containsNonTrim(java.lang.CharSequence charSequence)
Determines if a character sequence contains characters that are not characters that can be trimmed. This is useful for determining if a characer sequence actually contains useful data. Trimmed characters are denoted by the "WS" (whitespace) bidi class, the "Cc" (control) category, or the "Cf" (format) category inUnicodeData.txt
. This method does not handle Unicode supplementary characters.- Parameters:
charSequence
- The character sequence to be searched.- Returns:
true
if the given character sequence contains non-trim characters.- See Also:
Character.isSpaceChar(char)
,Character.isISOControl(char)
,Character.getType(char)
-
count
public static int count(java.lang.CharSequence charSequence, char character)
Counts the number of occurrences of a particular character in a character sequence.- Parameters:
charSequence
- The character sequence to examine.character
- The character to count.- Returns:
- The number of occurrences of the character in the character sequence.
-
count
public static int count(java.lang.CharSequence charSequence, char character, int index)
Counts the number of occurrences of a particular character in a character sequence, starting at a specified index and searching forward.- Parameters:
charSequence
- The character sequence to examine.character
- The character to count.index
- The index to start counting at.- Returns:
- The number of occurrences of the character in the character sequence.
-
endsWith
public static boolean endsWith(java.lang.CharSequence charSequence, char character)
Determines if the character sequence ends with the given character.- Parameters:
charSequence
- The character sequence to examine.character
- The character to compare.- Returns:
true
if the last character of the character sequence matches that of the given string.
-
endsWith
public static boolean endsWith(java.lang.CharSequence charSequence, java.lang.String string)
Determines if the character sequence ends with the given string.- Parameters:
charSequence
- The character sequence to examine.string
- The string to compare.- Returns:
true
if the last characters of the character sequence match those of the given string.
-
endsWithIgnoreCase
public static boolean endsWithIgnoreCase(java.lang.CharSequence charSequence, java.lang.String string)
Determines if the character sequence ends with the given string without case sensitivity.- Parameters:
charSequence
- The character sequence to examine.string
- The string to compare.- Returns:
true
if the last characters of the character sequence match those of the given string, case insensitively.
-
escapeHex
public static java.lang.String escapeHex(java.lang.CharSequence charSequence, Characters validCharacters, Characters invalidCharacters, int maxCharacter, char escapeChar, int escapeLength)
Escapes the indicated characters in the character sequence using the supplied escape character. All characters are first encoded using UTF-8. Every invalid character is converted to its Unicode hex equivalent and prefixed with the given escape character. This method uses lowercase hexadecimal escape codes. Characters are assumed to be valid unless specified otherwise. The escape character, if encountered, is not escaped unless it specifically meets one of the specified criteria; this allows re-escaping strings that may contain escape characters produced under less-strict rules (e.g. a URI containing escaped restricted characters, but still containing non-ASCII characters).- Parameters:
charSequence
- The data to escape.validCharacters
- The characters that should not be escaped and all others should be escaped, ornull
if characters should not be matched against valid characters.invalidCharacters
- The characters that, if they appear, should be escaped, ornull
if characters should not be matched against invalid characters.maxCharacter
- The character value that represents the highest non-escaped value.escapeChar
- The character to prefix the hex representation.escapeLength
- The number of characters to use for the hex representation.- Returns:
- A string containing the escaped data.
- Throws:
java.lang.IllegalArgumentException
- if neither valid nor invalid characters are given.
-
escapeHex
public static java.lang.String escapeHex(java.lang.CharSequence charSequence, Characters validCharacters, Characters invalidCharacters, int maxCharacter, char escapeChar, int escapeLength, Case hexCase)
Escapes the indicated characters in the character sequence using the supplied escape character. All characters are first encoded using UTF-8. Every invalid character is converted to its Unicode hex equivalent and prefixed with the given escape character. Characters are assumed to be valid unless specified otherwise. The escape character, if encountered, is not escaped unless it specifically meets one of the specified criteria; this allows re-escaping strings that may contain escape characters produced under less-strict rules (e.g. a URI containing escaped restricted characters, but still containing non-ASCII characters).- Parameters:
charSequence
- The data to escape.validCharacters
- The characters that should not be escaped and all others should be escaped, ornull
if characters should not be matched against valid characters.invalidCharacters
- The characters that, if they appear, should be escaped, ornull
if characters should not be matched against invalid characters.maxCharacter
- The character value that represents the highest non-escaped value.escapeChar
- The character to prefix the hex representation.escapeLength
- The number of characters to use for the hex representation.hexCase
- Whether the hex characters should be lowercase or uppercase.- Returns:
- A string containing the escaped data.
- Throws:
java.lang.IllegalArgumentException
- if neither valid nor invalid characters are given.
-
unescapeHex
public static java.lang.CharSequence unescapeHex(java.lang.CharSequence charSequence, char escapeChar, int escapeLength)
Decodes the escaped characters in the character sequence by converting the hex value after each occurrence of the escape character to the corresponding Unicode character using UTF-8.- Parameters:
charSequence
- The data to unescape.escapeChar
- The character that prefixes the hex representation.escapeLength
- The number of characters used for the hex representation.- Returns:
- A character sequence containing the unescaped data.
- Throws:
java.lang.IllegalArgumentException
- if a given escape character is not followed by an escape sequence.java.lang.IllegalArgumentException
- if an encountered escape sequence is not valid UTF-8.
-
indexOf
public static int indexOf(java.lang.CharSequence charSequence, char character)
Determines the first index of the given character.- Parameters:
charSequence
- The character sequence to check.character
- The character to search for.- Returns:
- The index of the first occurrence of the given character, or -1 if the character was not found.
-
indexOfLength
public static int indexOfLength(java.lang.CharSequence charSequence, char character)
Determines the first index of the given character.- Parameters:
charSequence
- The character sequence to check.character
- The character to search for.- Returns:
- The index of the first occurrence of the given character, or the length of the character sequence if the character was not found.
-
indexOf
public static int indexOf(java.lang.CharSequence charSequence, char character, int index)
Determines the first index of the given character. If the character sequence is aString
, this method delegates toString.indexOf(int, int)
.- Parameters:
charSequence
- The character sequence to check.character
- The character to search for.index
- The first index to examine.- Returns:
- The index of the first occurrence of the given character, or -1 if the character was not found.
-
indexOfLength
public static int indexOfLength(java.lang.CharSequence charSequence, char character, int index)
Determines the first index of the given character. If the character sequence is aString
, this method delegates toString.indexOf(int, int)
.- Parameters:
charSequence
- The character sequence to check.character
- The character to search for.index
- The first index to examine.- Returns:
- The index of the first occurrence of the given character, or the length of the character sequence if the character was not found.
-
indexOf
public static int indexOf(java.lang.CharSequence charSequence, Characters characters)
Searches a character sequence and returns the first index of any character of the given characters, starting at the beginning.- Parameters:
charSequence
- The character sequence to be searched.characters
- The characters to check.- Returns:
- The index of the first occurrence of one of the supplied characters, or -1 if none were found.
-
indexOfLength
public static int indexOfLength(java.lang.CharSequence charSequence, Characters characters)
Searches a character sequence and returns the first index of any character of the given characters, starting at the beginning.- Parameters:
charSequence
- The character sequence to be searched.characters
- The characters to check.- Returns:
- The index of the first occurrence of one of the supplied characters, or the length of the character sequence if none were found.
-
indexOf
public static int indexOf(java.lang.CharSequence charSequence, Characters characters, int index)
Searches a character sequence and returns the first index of any character of the given characters, starting at the given index.- Parameters:
charSequence
- The character sequence to be searched.characters
- The characters to check.index
- The index to search from.- Returns:
- The index of the first occurrence of one of the supplied characters, or -1 if none were found.
-
indexOfLength
public static int indexOfLength(java.lang.CharSequence charSequence, Characters characters, int index)
Searches a character sequence and returns the first index of any character of the given characters, starting at the given index.- Parameters:
charSequence
- The character sequence to be searched.characters
- The characters to check.index
- The index to search from.- Returns:
- The index of the first occurrence of one of the supplied characters, or the length of the character sequence if none were found.
-
lastIndexOf
public static int lastIndexOf(java.lang.CharSequence charSequence, char character)
Determines the last index of the given character.- Parameters:
charSequence
- The character sequence to check.character
- The character to search for.- Returns:
- The index of the last occurrence of the given character, or -1 if the character was not found.
-
lastIndexOf
public static int lastIndexOf(java.lang.CharSequence charSequence, char character, int index)
Determines the last index of the given character. If the character sequence is aString
, this method delegates toString.lastIndexOf(int, int)
.- Parameters:
charSequence
- The character sequence to check.character
- The character to search for.index
- The last index to examine; if greater than or equal to the length of this character sequence, it has the same effect as if it were equal to one less than the length of this character sequence, and the entire character sequence may be searched; if negative, it has the same effect as if it were -1, and -1 is returned.- Returns:
- The index of the last occurrence of the given character, or -1 if the character was not found.
-
lastIndexOf
public static int lastIndexOf(java.lang.CharSequence charSequence, Characters characters)
Searches a character sequence and returns the last index of any character of the given characters.- Parameters:
charSequence
- The character sequence to be searched.characters
- The characters to check.- Returns:
- The index of the last occurrence of one of the supplied characters, or -1 if none were found.
-
lastIndexOf
public static int lastIndexOf(java.lang.CharSequence charSequence, Characters characters, int index)
Searches a character sequence and returns the last index of any character of the given characters, starting at the given index.- Parameters:
charSequence
- The character sequence to be searched.characters
- The characters to check.index
- The last index to examine; if greater than or equal to the length of this character sequence, it has the same effect as if it were equal to one less than the length of this character sequence, and the entire character sequence may be searched; if negative, it has the same effect as if it were -1, and -1 is returned.- Returns:
- The index of the last occurrence of one of the supplied characters, or -1 if none were found.
-
indexNotOf
public static int indexNotOf(java.lang.CharSequence charSequence, char character)
Determines the first index not of the given character.- Parameters:
charSequence
- The character sequence to check.character
- The character to search for.- Returns:
- The index of the first occurrence not of the given character, or -1 if only the character was not found.
-
indexNotOfLength
public static int indexNotOfLength(java.lang.CharSequence charSequence, char character)
Determines the first index not of the given character.- Parameters:
charSequence
- The character sequence to check.character
- The character to search for.- Returns:
- The index of the first occurrence not of the given character, or the length of the character sequence if only the character was not found.
-
indexNotOf
public static int indexNotOf(java.lang.CharSequence charSequence, char character, int index)
Determines the first index not of the given character.- Parameters:
charSequence
- The character sequence to check.character
- The character to search for.index
- The first index to examine.- Returns:
- The index of the first occurrence not of the given character, or -1 if only the character was not found.
-
indexNotOfLength
public static int indexNotOfLength(java.lang.CharSequence charSequence, char character, int index)
Determines the first index not of the given character.- Parameters:
charSequence
- The character sequence to check.character
- The character to search for.index
- The first index to examine.- Returns:
- The index of the first occurrence not of the given character, or the length of the character sequence if only the character was not found.
-
indexNotOf
public static int indexNotOf(java.lang.CharSequence charSequence, Characters characters)
Searches a character sequence and returns the first index of any character not of the given characters, starting at the beginning.- Parameters:
charSequence
- The character sequence to be searched.characters
- The characters to check.- Returns:
- The index of the first occurrence not of one of the supplied characters, or -1 if only the characters were found.
-
indexNotOfLength
public static int indexNotOfLength(java.lang.CharSequence charSequence, Characters characters)
Searches a character sequence and returns the first index of any character not of the given characters, starting at the beginning.- Parameters:
charSequence
- The character sequence to be searched.characters
- The characters to check.- Returns:
- The index of the first occurrence not of one of the supplied characters, or the length of the character sequence if only the characters were found.
-
indexNotOf
public static int indexNotOf(java.lang.CharSequence charSequence, Characters characters, int index)
Searches a character sequence and returns the first index of any character not of the given characters, starting at the given index.- Parameters:
charSequence
- The character sequence to be searched.characters
- The characters to check.index
- The index to search from.- Returns:
- The index of the first occurrence not of one of the supplied characters, or -1 if only the characters were found.
-
indexNotOfLength
public static int indexNotOfLength(java.lang.CharSequence charSequence, Characters characters, int index)
Searches a character sequence and returns the first index of any character not of the given characters, starting at the given index.- Parameters:
charSequence
- The character sequence to be searched.characters
- The characters to check.index
- The index to search from.- Returns:
- The index of the first occurrence not of one of the supplied characters, or the length of the character sequence if only the characters were found.
-
lastIndexNotOf
public static int lastIndexNotOf(java.lang.CharSequence charSequence, char character)
Determines the last index not of the given character.- Parameters:
charSequence
- The character sequence to check.character
- The character to search for.- Returns:
- The index of the last occurrence not of the given character, or -1 if only the character was not found.
-
lastIndexNotOf
public static int lastIndexNotOf(java.lang.CharSequence charSequence, char character, int index)
Determines the last index not of the given character.- Parameters:
charSequence
- The character sequence to check.character
- The character to search for.index
- The last index to examine; if greater than or equal to the length of this character sequence, it has the same effect as if it were equal to one less than the length of this character sequence, and the entire character sequence may be searched; if negative, it has the same effect as if it were -1, and -1 is returned.- Returns:
- The index of the last occurrence not of the given character, or -1 if only the character was not found.
-
lastIndexNotOf
public static int lastIndexNotOf(java.lang.CharSequence charSequence, Characters characters)
Searches a character sequence and returns the last index of any character not of the given characters.- Parameters:
charSequence
- The character sequence to be searched.characters
- The characters to check.- Returns:
- The index of the last occurrence notof one of the supplied characters, or -1 if only the characters were found.
-
lastIndexNotOf
public static int lastIndexNotOf(java.lang.CharSequence charSequence, Characters characters, int index)
Searches a character sequence and returns the last index of any character not of the given characters, starting at the given index.- Parameters:
charSequence
- The character sequence to be searched.characters
- The characters to check.index
- The last index to examine; if greater than or equal to the length of this character sequence, it has the same effect as if it were equal to one less than the length of this character sequence, and the entire character sequence may be searched; if negative, it has the same effect as if it were -1, and -1 is returned.- Returns:
- The index of the last occurrence not of one of the supplied characters, or -1 if only the characters were found.
-
notCharIndexOf
@Deprecated public static int notCharIndexOf(java.lang.CharSequence charSequence, Characters notCharacters)
Deprecated.Searches a character sequence and returns the first index of any character not in the specified characters, starting from the beginning.- Parameters:
charSequence
- The character sequence to be searched.notCharacters
- The characters to check.- Returns:
- The index of the first occurrence of one of the supplied characters, or -1 if none were found.
-
notCharIndexOf
@Deprecated public static int notCharIndexOf(java.lang.CharSequence charSequence, Characters notCharacters, int index)
Deprecated.Searches a character sequence and returns the first index of any character not in the specified characters, starting at the given index.- Parameters:
charSequence
- The character sequence to be searched.notCharacters
- The characters to check.index
- The last index to examine; if greater than or equal to the length of this character sequence, it has the same effect as if it were equal to one less than the length of this character sequence, and the entire character sequence may be searched; if negative, it has the same effect as if it were -1, and -1 is returned.- Returns:
- The index of the first occurrence of one of the supplied characters, or -1 if none were found.
-
notCharLastIndexOf
@Deprecated public static int notCharLastIndexOf(java.lang.CharSequence charSequence, Characters notCharacters)
Deprecated.Searches a character sequence and returns the last index of any character not in the specified characters, starting at the last index.- Parameters:
charSequence
- The character sequence to be searched.notCharacters
- The characters to check.- Returns:
- The index of the last occurrence of one of the supplied characters, or -1 if none were found.
-
notCharLastIndexOf
@Deprecated public static int notCharLastIndexOf(java.lang.CharSequence charSequence, Characters notCharacters, int index)
Deprecated.Searches a character sequence and returns the last index of any character not in the specified characters, starting at the given index.- Parameters:
charSequence
- The character sequence to be searched.notCharacters
- The characters to check.index
- The last index to examine; if greater than or equal to the length of this character sequence, it has the same effect as if it were equal to one less than the length of this character sequence, and the entire character sequence may be searched; if negative, it has the same effect as if it were -1, and -1 is returned.- Returns:
- The index of the last occurrence of one of the supplied characters, or -1 if none were found.
-
isAll
public static final boolean isAll(java.lang.CharSequence charSequence, char c)
Determines if the character sequence consists of nothing but the following character.- Parameters:
charSequence
- The character sequence to examine.c
- The character that could make up the entire sequence.- Returns:
true
if there are no other characters but the specified character,false
if there are other characters or if the string is the empty string.
-
isAllChars
public static final boolean isAllChars(java.lang.CharSequence charSequence, Characters characters)
Determines if the character sequence consists of nothing but the given characters.- Parameters:
charSequence
- The character sequence to examine.characters
- The characters that could make up the entire string, in any order.- Returns:
true
if there are no other characters but the specified characters,false
if there are other characters or if the character sequence is empty.
-
isCapitalized
public static final boolean isCapitalized(java.lang.CharSequence charSequence)
Determines whether a character sequence is capitalized. A character sequence is capitalized if it contains any characters and the first character is uppercase.- Parameters:
charSequence
- The character sequence to examine.- Returns:
true
if the character sequence is capitalized.
-
isDigits
public static final boolean isDigits(java.lang.CharSequence charSequence)
Determines whether a character sequence contains only Unicode digits.- Parameters:
charSequence
- The character sequence to examine.- Returns:
true
if all the characters in the sequence are digits.
-
isLatinDigits
@Deprecated public static final boolean isLatinDigits(java.lang.CharSequence charSequence)
Deprecated.Create separateisCharacters()
method and useASCII.DIGIT_CHARACTERS
.Determines whether a character sequence contains only the digits '0'-'9'.- Parameters:
charSequence
- The character sequence to examine.- Returns:
true
if all the characters in the sequence are ISO_LATIN_1 digits.
-
isLetters
public static final boolean isLetters(java.lang.CharSequence charSequence)
Determines whether a character sequence contains only Unicode letters.- Parameters:
charSequence
- The character sequence to examine.- Returns:
true
if all the characters in the sequence are letters.
-
isLettersDigits
public static final boolean isLettersDigits(java.lang.CharSequence charSequence)
Determines whether a character sequence contains only Unicode letters and digits.- Parameters:
charSequence
- The character sequence to examine.- Returns:
true
if all the characters in the sequence are letters and digits.
-
isLettersDigitsCharacters
public static final boolean isLettersDigitsCharacters(java.lang.CharSequence charSequence, java.lang.String characters)
Determines whether a character sequence contains only Unicode letters, digits, and the supplied extra characters.- Parameters:
charSequence
- The character sequence to examine.characters
- Extra characters to allow.- Returns:
true
if all the characters in the sequence are letters, digits, and/or allowed characters.
-
isNumber
public static final boolean isNumber(java.lang.CharSequence charSequence)
Determines whether a character sequence contains only numbers and decimals or commas.- Parameters:
charSequence
- The character sequence to examine.- Returns:
true
if all the characters represent a number.
-
isRomanNumerals
public static final boolean isRomanNumerals(java.lang.CharSequence charSequence)
Determines whether a character sequeence contains only Roman numerals.- Parameters:
charSequence
- The character sequence to examine.- Returns:
true
if all the characters in the sequence are roman numerals.
-
isUpperCase
public static final boolean isUpperCase(java.lang.CharSequence charSequence)
Determines whether all the letters in a character sequence are capital letters.- Parameters:
charSequence
- The character sequence to examine.- Returns:
true
if all the letters in the sequence are capitalized.
-
join
public static java.lang.CharSequence join(java.lang.CharSequence... charSequences)
Concatenates the given character sequences with no delimiter between them.- Parameters:
charSequences
- The character sequences to be concatenated.- Returns:
- The string containing the concatenated character sequences.
- Throws:
java.lang.NullPointerException
- if the given character sequences isnull
.
-
join
public static java.lang.CharSequence join(char delimiter, java.lang.CharSequence... charSequences)
Concatenates the given character sequences, separated by the given delimiter.- Parameters:
delimiter
- The delimiter to be placed between each character sequence, orCharacters.UNDEFINED_CHAR
if no delimiter should be placed between the character sequences.charSequences
- The character sequences to be concatenated.- Returns:
- The string containing the concatenated character sequences.
- Throws:
java.lang.NullPointerException
- if the given character sequences isnull
.
-
split
public static java.lang.CharSequence[] split(java.lang.CharSequence charSequence, char delimiter)
Deprecated.Splits a characters sequence into subsequences based upon the given delimiter. Subsequences will be returned between delimiters even if they are empty, and a subsequence will be returned after the last delimiter, even if there are no remaining characters. In other words, the number of character subsequences returned is delimiterCount+1.- Parameters:
charSequence
- The character sequence to split.delimiter
- The delimiter to use for splitting.- Returns:
- An array of character subsequences between the delimiters.
-
removeMarks
public static java.lang.String removeMarks(java.lang.CharSequence charSequence)
Removes all normalized Unicode marks such as accents from a string. For example:- 'é' will be converted to 'e' (Unicode non-spacing marks)
- vowel signs in Hindi will be removed (Unicode spacing combining marks)
- circles around characters will be removed (Unicode enclosing marks)
- Parameters:
charSequence
- The character sequence from which to remove marks.- Returns:
- The normalized string with marks removed.
- See Also:
- Java - getting rid of accents and converting them to regular letters,
normalizeForSearch(CharSequence)
-
normalizeForSearch
public static java.lang.String normalizeForSearch(@Nonnull java.lang.CharSequence charSequence)
Normalizes a string so that it can be used as a liberally matching lookup without regard to diacritics or case.- Decomposes characters such as fi to fi.
- Removes all normalized Unicode marks such as accents.
- Converts the string to lowercase.
This method converts to lowercase using
Locale.ROOT
. If you wish you supply a specific locale, usenormalizeForSearch(CharSequence, Locale)
.- Parameters:
charSequence
- The character sequence from which to remove marks.- Returns:
- The normalized string with marks removed.
- See Also:
- Java - getting rid of accents and converting them to regular letters
-
normalizeForSearch
public static java.lang.String normalizeForSearch(@Nonnull java.lang.CharSequence charSequence, @Nonnull java.util.Locale locale)
Normalizes a string so that it can be used as a liberally matching lookup without regard to diacritics or case.- Decomposes characters such as fi to fi.
- Removes all normalized Unicode marks such as accents.
- Converts the string to lowercase.
- Parameters:
charSequence
- The character sequence from which to remove marks.locale
- The locale to use for normalization; specifically for converting to lowercase.- Returns:
- The normalized string with marks removed.
- See Also:
- Java - getting rid of accents and converting them to regular letters
-
startsWith
public static boolean startsWith(java.lang.CharSequence charSequence, char character)
Determines if the character sequence starts with the given character.- Parameters:
charSequence
- The character sequence to examine.character
- The character to compare.- Returns:
true
if the first character of the character sequence matches that of the given string.
-
startsWith
public static boolean startsWith(java.lang.CharSequence charSequence, java.lang.CharSequence string)
Determines if the character sequence starts with the given string.- Parameters:
charSequence
- The character sequence to examine.string
- The string to compare.- Returns:
true
if the first characters of the character sequence match those of the given string.- Throws:
java.lang.NullPointerException
- if the given string isnull
.
-
startsWith
public static boolean startsWith(java.lang.CharSequence charSequence, int index, java.lang.CharSequence string)
Determines if the character sequence starts with the given string, starting at the given index.- Parameters:
charSequence
- The character sequence to examine.index
- The index at which to search.string
- The string to compare.- Returns:
true
if the first characters of the character sequence match those of the given string.- Throws:
java.lang.NullPointerException
- if the given string isnull
.
-
getStartsWith
public static <S extends java.lang.CharSequence> S getStartsWith(java.lang.CharSequence charSequence, java.util.Collection<S> strings)
Determines which if any of the given strings the character sequence starts with.- Type Parameters:
S
- The type of the charSequence.- Parameters:
charSequence
- The character sequence to examine.strings
- The string to compare.- Returns:
- The string beginning the character sequence, or
null
if none of the strings start the character sequence. - Throws:
java.lang.NullPointerException
- if the collection of strings of any of the strings isnull
.
-
getStartsWith
public static <S extends java.lang.CharSequence> S getStartsWith(java.lang.CharSequence charSequence, int index, java.util.Collection<S> strings)
Determines which if any of the given strings the character sequence starts with, starting at the given index.- Type Parameters:
S
- The type of the charSequence.- Parameters:
charSequence
- The character sequence to examine.index
- The index at which to search.strings
- The string to compare.- Returns:
- The string beginning the character sequence, or
null
if none of the strings start the character sequence. - Throws:
java.lang.NullPointerException
- if the collection of strings of any of the strings isnull
.
-
startsWithChar
public static boolean startsWithChar(java.lang.CharSequence charSequence, Characters characters)
Determines if the character sequence starts with one of the given characters.- Parameters:
charSequence
- The character sequence to examine.characters
- The characters to compare.- Returns:
true
if the first character of the character sequence matches one of those in the given string.
-
toCharArray
public static char[] toCharArray(java.lang.CharSequence charSequence)
Returns a character array containing the characters from the given character sequence.- Parameters:
charSequence
- The character sequence from which to retrieve characters.- Returns:
- A character array containing the characters from the given character sequence.
- Throws:
java.lang.NullPointerException
- if the given character sequence isnull
.
-
truncateAtFirst
public static java.lang.CharSequence truncateAtFirst(java.lang.CharSequence charSequence, char truncateChar)
Truncates the end of the string beginning at the first occurrence of the given character. If the character sequence does not contain the truncate character, no action takes place.- Parameters:
charSequence
- The character sequence to check.truncateChar
- The character indicating the part of the sequence to trim.- Returns:
- A new character sequence with the specified character and following characters removed.
-
truncateAtLast
public static java.lang.CharSequence truncateAtLast(java.lang.CharSequence charSequence, char truncateChar)
Truncates the end of the string beginning at the last occurrence of the given character. If the character sequence does not contain the truncate character, no action takes place.- Parameters:
charSequence
- The character sequence to check.truncateChar
- The character indicating the part of the sequence to trim.- Returns:
- A new character sequence with the last of the specified character and following characters removed.
-
equals
public static boolean equals(java.lang.CharSequence charSequence, char character)
Determines if the given character sequence is composed of the single given character. This method allows comparison of a character string with a character without creating a string for the character, for example.- Parameters:
charSequence
- The character sequence to compare.character
- The character to compare with the character sequence.- Returns:
true
if the character sequence is composed of one character and that character matches the given character.
-
equals
public static boolean equals(java.lang.CharSequence charSequence1, java.lang.CharSequence charSequence2)
Compares the characters in one character sequence with characters in another character sequence.- Parameters:
charSequence1
- The character sequence to compare.charSequence2
- The character sequence to compare with.- Returns:
true
if the characters in the first character sequence equal the characters in the second character sequence.
-
equals
public static boolean equals(java.lang.CharSequence charSequence1, java.lang.CharSequence charSequence2, int start)
Compares the characters in one character sequence with characters in another character sequence, starting at the given location to the end of the second character sequence.- Parameters:
charSequence1
- The character sequence to compare.charSequence2
- The character sequence to compare with.start
- The starting location in the second character sequence, inclusive.- Returns:
true
if the characters in the first character sequence equal the indicated characters in the second character sequence.- Throws:
java.lang.StringIndexOutOfBoundsException
- ifstart
is negative or greater than the length of the second character sequence.
-
equals
public static boolean equals(java.lang.CharSequence charSequence1, java.lang.CharSequence charSequence2, int start, int end)
Compares the characters in one character sequence with characters in another character sequence. If the given end of the second character sequence (the character sequence to which the first is being compared) is past the end, it is adjusted to be equal to the end of the second character sequence.- Parameters:
charSequence1
- The character sequence to compare.charSequence2
- The character sequence to compare with.start
- The starting location in the second character sequence, inclusive.end
- The ending location in the second character sequence, exclusive.- Returns:
true
if the characters in the first character sequence equal the indicated characters in the second character sequence.- Throws:
java.lang.StringIndexOutOfBoundsException
- ifstart
orend
is negative or greater thanlength()
, orstart
is greater thanend
, with the exception that ifend
is greater than the length of the second character sequence it will be adjusted to equal the end.
-
equals
public static boolean equals(java.lang.CharSequence charSequence1, int start1, int end1, java.lang.CharSequence charSequence2, int start2, int end2)
Compares characters in one character sequence with characters in another character sequence. If the given end of the second character sequence (the character sequence to which the first is being compared) is past the end, it is adjusted to be equal to the end of the second character sequence.- Parameters:
charSequence1
- The character sequence to compare.start1
- The starting location in the first character sequence, inclusive.end1
- The ending location in the first character sequence, exclusive.charSequence2
- The character sequence to compare with.start2
- The starting location in the second character sequence, inclusive.end2
- The ending location in the second character sequence, exclusive.- Returns:
true
if the indicated characters in the first character sequence equal the indicated characters in the second character sequence.- Throws:
java.lang.StringIndexOutOfBoundsException
- ifstart
orend
is negative or greater thanlength()
, orstart
is greater thanend
, with the exception that ifend2
is greater than the length of the second character sequence it will be adjusted to equal the end.
-
denull
public static java.lang.CharSequence denull(java.lang.CharSequence charSequence)
Turns a null character sequence into an empty character sequence.- Parameters:
charSequence
- The character sequence to examine, ornull
.- Returns:
- The given character sequence, or an empty character sequence if the given character sequence is
null
;. - See Also:
nullify(CharSequence)
-
nullify
public static <CS extends java.lang.CharSequence> CS nullify(CS charSequence)
Turns an empty character sequence intonull
.- Type Parameters:
CS
- The type of the charSequence.- Parameters:
charSequence
- The character sequence to examine, ornull
.- Returns:
- The given character sequence, or
null
if the given character sequence has no characters or no character sequence was given. - See Also:
denull(CharSequence)
-
-