| Modifier and Type | Class and Description |
|---|---|
static class |
CString.StringLengthComparator
A generic String comparator that compares two Strings based upon their
length.
|
| Modifier and Type | Method and Description |
|---|---|
static String |
alignLeft(String input,
int length,
char pad)
Left aligns the supplied input String in a String with a length equal
to the supplied length.
|
static String |
alignRight(String input,
int length,
char pad)
Right aligns the supplied input String in a String with a length equal
to the supplied length.
|
static String |
arrayToPlainCsv(Object... values)
Converts the supplied array of values to a string of comma separated
values.
|
static void |
checkMatchingCharacters(String input,
char opening,
char closing)
Checks that the supplied input has matching opening and closing
characters, where opening and closing characters may not be nested.
|
static int |
count(String source,
String find)
Counts the number of occurrences of the supplied string to find in the
supplied source string.
|
static String |
escapeControlCharacters(String input)
Replaces control characters in the range 00-1F with escape characters.
|
static String |
findMatch(String inputText,
String regularExpression)
Finds the text within the supplied inputText that matches the supplied
regularExpression.
|
static String |
getEscapedControlCharacter(int ordinal)
Gets the escape sequence for the control character with the supplied
ordinal.
|
static String |
getRight(String string,
int length)
Gets the supplied length number of characters from the right of the
supplied string.
|
static boolean |
isAlphabetic(String input)
Determines whether the supplied input string consists of alphabetic
characters (letters) only.
|
static boolean |
isAlphaNumeric(String input)
Determines whether the supplied input String consists of alphabetic
letters and numeric characters (digits) only.
|
static boolean |
isHexaDecimal(String input)
Determines whether the supplied input String consists of hexadecimal
characters only.
|
static boolean |
isNotEmpty(String input)
Determines whether the supplied input string is not empty.
|
static boolean |
isNullOrEmpty(String input)
Determines whether the supplied input String is null or empty.
|
static boolean |
isNumeric(String input)
Determines whether the supplied input string consists of numeric
characters (digits) only.
|
static boolean |
isWhiteSpace(String input)
Determines whether the supplied input String consists of whitespace
characters only.
|
static <T> String |
iterableToString(Iterable<T> iterable)
Creates a String representation of the supplied iterable.
|
static String |
removeEndOfLineCharacters(String input)
Removes all the end of line characters from the supplied input String.
|
static String |
removePrefixCharacters(String input,
char prefix)
Removes all the supplied prefix characters from the supplied input.
|
static String |
repeat(String input,
int repeat)
Creates a String that consists of a repetition, determined by the
supplied repeat count, of the supplied input String.
|
static String |
replace(String input,
String oldString,
String newString)
Replaces all occurrences of oldString with newString in the supplied
input String.
|
static String[] |
tokenize(String input)
Tokenizes a String.
|
static String[] |
tokenize(String input,
String delimiters)
Tokenizes a String.
|
static String |
trim(Trim trim,
String input)
Trims whitespace from the supplied input.
|
static String |
trimAll(String input)
Trims all whitespace characters from the supplied input, no matter where
they are located.
|
static String |
trimLeft(String input)
Trims whitespace from the left of the supplied input.
|
static String |
trimRight(String input)
Trims whitespace from the right of the supplied input.
|
public static String[] tokenize(String input)
input - Input string to split into tokens.StringTokenizer.StringTokenizer(String)public static String[] tokenize(String input, String delimiters)
input - Input string to split into tokens.delimiters - The delimiters to split the supplied input into
separate tokens.
NullPointerException - When the supplied delimiters is null.IllegalArgumentException - When the supplied delimiters is empty.StringTokenizer.StringTokenizer(String,String)public static String getRight(String string, int length)
string - The string to get the characters from the right from.length - The number of characters to get from the right of the
supplied string.IllegalArgumentException - When the supplied length is less than
zero.NullPointerException - When the supplied string is null.StringIndexOutOfBoundsException - When the supplied length is
larger than the length of the supplied string.public static String replace(String input, String oldString, String newString)
input - The input String that contains the Strings (zero or more)
that need to be replaced.oldString - The String in the input String that must be replaced.newString - The String that replaces all occurrences of the
oldString in the supplied input.public static String repeat(String input, int repeat)
input - Input String that will be repeated.repeat - The number of times the supplied input String will be
repeated.
IllegalArgumentException - When the supplied repeat count is
negative.NullPointerException - When the supplied input String is null.public static String alignLeft(String input, int length, char pad)
| Parameters | Returns |
|---|---|
| "1234", 6, '0' | 123400 |
| "1234", 2, '0' | 12 |
input - The input String to align left.length - The length of the resulting left aligned String.
pad - The pad char used to fill the vacated positions.
IllegalArgumentException - When the supplied length is less than
one.NullPointerException - When the supplied input String is null.public static String alignRight(String input, int length, char pad)
| Parameters | Returns |
|---|---|
| "1234", 6, '0' | 001234 |
| "1234", 2, '0' | 34 |
input - The input String to align right.length - The length of the resulting right aligned String.
pad - The pad char used to fill the vacated positions.
IllegalArgumentException - When the supplied length is less than
one.NullPointerException - When the supplied input String is null.public static String removePrefixCharacters(String input, char prefix)
input - The input String from which to remove the prefix
characters.prefix - The prefix characters to remove.public static String arrayToPlainCsv(Object... values)
values - The array of values that must be comma separated.public static String escapeControlCharacters(String input)
input - Input string.public static String getEscapedControlCharacter(int ordinal)
ordinal - The ordinal between 0 and 31 (inclusive) to get the escape
sequence for.IllegalArgumentException - When the supplied ordinal is not between
0 and 31 (inclusive).public static int count(String source, String find)
source - Input string.find - String that will be searched for and counted, in the input
string.public static boolean isNullOrEmpty(String input)
input - Input String to test.public static boolean isNotEmpty(String input)
input - Input string to test.public static boolean isAlphabetic(String input)
input - Input string to test.NullPointerException - When the supplied input is null.public static boolean isNumeric(String input)
input - Input string to test.NullPointerException - When the supplied input is null.public static boolean isAlphaNumeric(String input)
input - Input string to test.NullPointerException - When the supplied input is null.public static boolean isWhiteSpace(String input)
input - Input string to test.NullPointerException - When the supplied input is null.public static boolean isHexaDecimal(String input)
input - Input string to test.NullPointerException - When the supplied input is null.Long.parseLong(String, int)public static String trim(Trim trim, String input)
trim - Determines where the whitespace is trimmed from.input - The input to trim.public static String trimLeft(String input)
input - The input to trim.Character.isWhitespace(char)public static String trimRight(String input)
input - The input to trim.Character.isWhitespace(char)public static String trimAll(String input)
input - The input to trim.Character.isWhitespace(char)public static <T> String iterableToString(Iterable<T> iterable)
T - The type of the iterable.iterable - The iterable to create a String representation of.public static String findMatch(String inputText, String regularExpression)
Pattern.DOTALL.inputText - The input text.regularExpression - The regular expression used for matching.public static void checkMatchingCharacters(String input, char opening, char closing)
input - Input to check for matching opening and closing characters.opening - The opening character.closing - The closing character.IllegalArgumentException - When either the supplied opening or
closing character is 0 or when the supplied input has at least a single
opening or closing character and the opening and closing characters do
not match.public static String removeEndOfLineCharacters(String input)
input - The input to remove end of line characters from.Copyright © 2008–2017. All rights reserved.