public class StringUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
DOLLAR_SLASHY |
static int |
NONE_SLASHY |
static int |
SLASHY |
Constructor and Description |
---|
StringUtils() |
Modifier and Type | Method and Description |
---|---|
static long |
countChar(java.lang.String text,
char c) |
static boolean |
isEmpty(java.lang.CharSequence cs)
Copied from Apache commons-lang3-3.6
|
static java.lang.String |
removeCR(java.lang.String text) |
static java.lang.String |
replace(java.lang.String text,
java.lang.String searchString,
java.lang.String replacement)
The modified implementation is based on StringUtils#replace(String text, String searchString, String replacement, int max), Apache commons-lang3-3.6
|
static java.lang.String |
replaceEscapes(java.lang.String text,
int slashyType) |
static java.lang.String |
replaceHexEscapes(java.lang.String text) |
static java.lang.String |
replaceOctalEscapes(java.lang.String text) |
static java.lang.String |
replaceStandardEscapes(java.lang.String text) |
static java.lang.String |
trimQuotations(java.lang.String text,
int quotationLength) |
public static final int NONE_SLASHY
public static final int SLASHY
public static final int DOLLAR_SLASHY
public static java.lang.String replaceHexEscapes(java.lang.String text)
public static java.lang.String replaceOctalEscapes(java.lang.String text)
public static java.lang.String replaceStandardEscapes(java.lang.String text)
public static java.lang.String replaceEscapes(java.lang.String text, int slashyType)
public static java.lang.String removeCR(java.lang.String text)
public static long countChar(java.lang.String text, char c)
public static java.lang.String trimQuotations(java.lang.String text, int quotationLength)
public static java.lang.String replace(java.lang.String text, java.lang.String searchString, java.lang.String replacement)
Replaces all occurrences of a String within another String.
A null
reference passed to this method is a no-op.
StringUtils.replace(null, *, *) = null StringUtils.replace("", *, *) = "" StringUtils.replace("any", null, *) = "any" StringUtils.replace("any", *, null) = "any" StringUtils.replace("any", "", *) = "any" StringUtils.replace("aba", "a", null) = "aba" StringUtils.replace("aba", "a", "") = "b" StringUtils.replace("aba", "a", "z") = "zbz"
text
- text to search and replace in, may be nullsearchString
- the String to search for, may be nullreplacement
- the String to replace it with, may be nullnull
if null String inputpublic static boolean isEmpty(java.lang.CharSequence cs)
Checks if a CharSequence is empty ("") or null.
StringUtils.isEmpty(null) = true StringUtils.isEmpty("") = true StringUtils.isEmpty(" ") = false StringUtils.isEmpty("bob") = false StringUtils.isEmpty(" bob ") = false
NOTE: This method changed in Lang version 2.0. It no longer trims the CharSequence. That functionality is available in isBlank().
cs
- the CharSequence to check, may be nulltrue
if the CharSequence is empty or null