public class StringUtils
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
StringUtils.SearchMode |
Modifier and Type | Field and Description |
---|---|
static java.util.Set<StringUtils.SearchMode> |
SEARCH_MODE__ALL
Full search mode: allow backslash escape, skip between markers, skip block comments, skip line comments and skip white space.
|
static java.util.Set<StringUtils.SearchMode> |
SEARCH_MODE__BSESC_COM_WS
Search mode: allow backslash escape, skip block comments, skip line comments and skip white space.
|
static java.util.Set<StringUtils.SearchMode> |
SEARCH_MODE__BSESC_MRK_WS
Search mode: allow backslash escape, skip between markers and skip white space.
|
static java.util.Set<StringUtils.SearchMode> |
SEARCH_MODE__COM_WS
Search mode: skip block comments, skip line comments and skip white space.
|
static java.util.Set<StringUtils.SearchMode> |
SEARCH_MODE__MRK_COM_WS
Search mode: skip between markers, skip block comments, skip line comments and skip white space.
|
static java.util.Set<StringUtils.SearchMode> |
SEARCH_MODE__MRK_WS
Search mode: skip between markers and skip white space.
|
static java.util.Set<StringUtils.SearchMode> |
SEARCH_MODE__NONE
Empty search mode.
|
Constructor and Description |
---|
StringUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
appendAsHex(java.lang.StringBuilder builder,
byte[] bytes) |
static void |
appendAsHex(java.lang.StringBuilder builder,
int value) |
static boolean |
canHandleAsServerPreparedStatementNoCache(java.lang.String sql,
ServerVersion serverVersion,
boolean allowMultiQueries,
boolean noBackslashEscapes,
boolean useAnsiQuotes) |
static java.lang.String |
dumpAsHex(byte[] byteBuffer,
int length)
Returns the given bytes as a hex and ascii dump (up to length bytes).
|
static java.lang.String |
escapeQuote(java.lang.String src,
java.lang.String quotChar) |
static char |
firstAlphaCharUc(java.lang.String searchIn,
int startAt) |
static char |
firstNonWsCharUc(java.lang.String searchIn)
Returns the first non-whitespace char, converted to upper case
|
static char |
firstNonWsCharUc(java.lang.String searchIn,
int startAt) |
static java.lang.String |
fixDecimalExponent(java.lang.String dString)
Adds '+' to decimal numbers that are positive (MySQL doesn't understand
them otherwise
|
static byte[] |
getBytes(char[] value)
Returns the byte[] representation of subset of the given char[] using the default/platform encoding.
|
static byte[] |
getBytes(char[] value,
int offset,
int length) |
static byte[] |
getBytes(char[] value,
int offset,
int length,
java.lang.String encoding)
Returns the byte[] representation of subset of the given char[] using the given encoding.
|
static byte[] |
getBytes(char[] c,
java.lang.String encoding)
Returns the byte[] representation of subset of the given char[] using the given encoding.
|
static byte[] |
getBytes(java.lang.String value) |
static byte[] |
getBytes(java.lang.String value,
int offset,
int length) |
static byte[] |
getBytes(java.lang.String value,
int offset,
int length,
java.lang.String encoding) |
static byte[] |
getBytes(java.lang.String s,
java.lang.String encoding)
Returns the byte[] representation of the given string using the given encoding.
|
static byte[] |
getBytesNullTerminated(java.lang.String value,
java.lang.String encoding) |
static byte[] |
getBytesWrapped(java.lang.String s,
char beginWrap,
char endWrap,
java.lang.String encoding)
Returns the byte[] representation of the given string properly wrapped between the given char delimiters using the given encoding.
|
static java.lang.String |
getFullyQualifiedName(java.lang.String db,
java.lang.String entity,
java.lang.String quoteId,
boolean isPedantic)
Builds and returns a fully qualified name, quoted if necessary, for the given database entity.
|
static java.lang.String |
getUniqueSavepointId() |
static boolean |
hasWildcards(java.lang.String src)
Does the string contain wildcard symbols ('%' or '_').
|
static int |
indexOf(byte[] s,
char c) |
static int |
indexOfIgnoreCase(int startingPosition,
java.lang.String searchIn,
java.lang.String searchFor)
Finds the position of a substring within a string ignoring case.
|
static int |
indexOfIgnoreCase(int startingPosition,
java.lang.String searchIn,
java.lang.String[] searchForSequence,
java.lang.String openingMarkers,
java.lang.String closingMarkers,
java.util.Set<StringUtils.SearchMode> searchMode)
Finds the position of the first of a consecutive sequence of strings within a string, ignoring case, with the option to skip text delimited by given
markers or within comments.
|
static int |
indexOfIgnoreCase(int startingPosition,
java.lang.String searchIn,
java.lang.String searchFor,
java.lang.String openingMarkers,
java.lang.String closingMarkers,
java.util.Set<StringUtils.SearchMode> searchMode)
Finds the position of a substring within a string, ignoring case, with the option to skip text delimited by given markers or within comments.
|
static int |
indexOfIgnoreCase(int startingPosition,
java.lang.String searchIn,
java.lang.String searchFor,
java.lang.String openingMarkers,
java.lang.String closingMarkers,
java.lang.String overridingMarkers,
java.util.Set<StringUtils.SearchMode> searchMode)
Finds the position of a substring within a string, ignoring case, with the option to skip text delimited by given markers or within comments.
|
static int |
indexOfIgnoreCase(java.lang.String searchIn,
java.lang.String searchFor)
Finds the position of a substring within a string ignoring case.
|
static int |
indexOfQuoteDoubleAware(java.lang.String searchIn,
java.lang.String quoteChar,
int startFrom) |
static boolean |
isEmptyOrWhitespaceOnly(java.lang.String str) |
static boolean |
isNullOrEmpty(java.lang.String toTest) |
static boolean |
isStrictlyNumeric(java.lang.CharSequence cs)
Checks is the CharSequence contains digits only.
|
static boolean |
isValidIdChar(char c) |
static java.lang.String |
joinWithSerialComma(java.util.List<?> elements)
Joins all elements of the given list using serial comma (Oxford comma) rules.
|
static int |
lastIndexOf(byte[] s,
char c) |
static java.lang.String |
padString(java.lang.String stringVal,
int requiredLength) |
static byte[] |
quoteBytes(byte[] bytes) |
static java.lang.String |
quoteIdentifier(java.lang.String identifier,
boolean isPedantic)
Surrounds identifier with "`" and duplicates these symbols inside the identifier.
|
static java.lang.String |
quoteIdentifier(java.lang.String identifier,
java.lang.String quoteChar,
boolean isPedantic)
Surrounds identifier with quoteChar and duplicates these symbols inside the identifier.
|
static int |
safeIntParse(java.lang.String intAsString) |
static java.lang.String |
safeTrim(java.lang.String toTrim) |
static java.lang.String |
sanitizeProcOrFuncName(java.lang.String src)
Next two functions are to help DBMD check if
the given string is in form of database.name and return it
as "database";"name" with comments removed.
|
static java.util.List<java.lang.String> |
split(java.lang.String stringToSplit,
java.lang.String delimiter,
boolean trim)
Splits stringToSplit into a list, using the given delimiter
|
static java.util.List<java.lang.String> |
split(java.lang.String stringToSplit,
java.lang.String delimiter,
java.lang.String openingMarkers,
java.lang.String closingMarkers,
boolean trim)
Splits stringToSplit into a list, using the given delimiter and skipping all between the given markers.
|
static java.util.List<java.lang.String> |
split(java.lang.String stringToSplit,
java.lang.String delimiter,
java.lang.String openingMarkers,
java.lang.String closingMarkers,
boolean trim,
java.util.Set<StringUtils.SearchMode> searchMode)
Splits stringToSplit into a list, using the given delimiter and skipping all between the given markers.
|
static java.util.List<java.lang.String> |
split(java.lang.String stringToSplit,
java.lang.String delimiter,
java.lang.String openingMarkers,
java.lang.String closingMarkers,
java.lang.String overridingMarkers,
boolean trim)
Splits stringToSplit into a list, using the given delimiter and skipping all between the given markers.
|
static java.util.List<java.lang.String> |
split(java.lang.String stringToSplit,
java.lang.String delimiter,
java.lang.String openingMarkers,
java.lang.String closingMarkers,
java.lang.String overridingMarkers,
boolean trim,
java.util.Set<StringUtils.SearchMode> searchMode)
Splits stringToSplit into a list, using the given delimiter and skipping all between the given markers.
|
static java.util.List<java.lang.String> |
splitDBdotName(java.lang.String source,
java.lang.String db,
java.lang.String quoteId,
boolean isNoBslashEscSet)
Splits an entity identifier into its parts (database and entity name) and returns a list containing the two elements.
|
static boolean |
startsWithIgnoreCase(java.lang.String searchIn,
int startAt,
java.lang.String searchFor)
Determines whether or not the string 'searchIn' contains the string
'searchFor', dis-regarding case starting at 'startAt' Shorthand for a
String.regionMatch(...)
|
static boolean |
startsWithIgnoreCase(java.lang.String searchIn,
java.lang.String searchFor)
Determines whether or not the string 'searchIn' contains the string
'searchFor', dis-regarding case.
|
static boolean |
startsWithIgnoreCaseAndNonAlphaNumeric(java.lang.String searchIn,
java.lang.String searchFor)
Determines whether or not the string 'searchIn' contains the string
'searchFor', disregarding case,leading whitespace and non-alphanumeric
characters.
|
static boolean |
startsWithIgnoreCaseAndWs(java.lang.String searchIn,
java.lang.String searchFor)
Determines whether or not the string 'searchIn' contains the string
'searchFor', disregarding case and leading whitespace
|
static int |
startsWithIgnoreCaseAndWs(java.lang.String searchIn,
java.lang.String[] searchFor)
Determines whether or not the string 'searchIn' starts with one of the strings in 'searchFor', disregarding case
and leading whitespace
|
static boolean |
startsWithIgnoreCaseAndWs(java.lang.String searchIn,
java.lang.String searchFor,
int beginPos)
Determines whether or not the string 'searchIn' contains the string
'searchFor', disregarding case and leading whitespace
|
static java.lang.String |
stringArrayToString(java.lang.String[] elems,
java.lang.String prefix,
java.lang.String midDelimiter,
java.lang.String lastDelimiter,
java.lang.String suffix)
Constructs a String containing all the elements in the String array bounded and joined by the provided concatenation elements.
|
static java.lang.String |
stripComments(java.lang.String src,
java.lang.String stringOpens,
java.lang.String stringCloses,
boolean slashStarComments,
boolean slashSlashComments,
boolean hashComments,
boolean dashDashComments)
Returns the given string, with comments removed
|
static byte[] |
stripEnclosure(byte[] source,
java.lang.String prefix,
java.lang.String suffix) |
static java.lang.String |
toAsciiString(byte[] buffer)
Returns the bytes as an ASCII String.
|
static java.lang.String |
toAsciiString(byte[] buffer,
int startPos,
int length)
Returns the bytes as an ASCII String.
|
static java.lang.String |
toHexString(byte[] byteBuffer,
int length)
Converts the given byte array into Hex String, stopping at given length.
|
static java.lang.String |
toString(byte[] value) |
static java.lang.String |
toString(byte[] value,
int offset,
int length) |
static java.lang.String |
toString(byte[] value,
int offset,
int length,
java.lang.String encoding) |
static java.lang.String |
toString(byte[] value,
java.lang.String encoding) |
static byte[] |
unquoteBytes(byte[] bytes) |
static java.lang.String |
unQuoteIdentifier(java.lang.String identifier,
java.lang.String quoteChar)
Trims identifier, removes quote chars from first and last positions
and replaces double occurrences of quote char from entire identifier,
i.e converts quoted identifier into form as it is stored in database.
|
static boolean |
wildCompareIgnoreCase(java.lang.String searchIn,
java.lang.String searchFor)
Compares searchIn against searchForWildcard with wildcards, in a case insensitive manner.
|
public static final java.util.Set<StringUtils.SearchMode> SEARCH_MODE__ALL
public static final java.util.Set<StringUtils.SearchMode> SEARCH_MODE__MRK_COM_WS
public static final java.util.Set<StringUtils.SearchMode> SEARCH_MODE__BSESC_COM_WS
public static final java.util.Set<StringUtils.SearchMode> SEARCH_MODE__BSESC_MRK_WS
public static final java.util.Set<StringUtils.SearchMode> SEARCH_MODE__COM_WS
public static final java.util.Set<StringUtils.SearchMode> SEARCH_MODE__MRK_WS
public static final java.util.Set<StringUtils.SearchMode> SEARCH_MODE__NONE
public static java.lang.String dumpAsHex(byte[] byteBuffer, int length)
byteBuffer
- the data to dump as hexlength
- the number of bytes to printpublic static java.lang.String toHexString(byte[] byteBuffer, int length)
byteBuffer
- the byte array to convertlength
- the number of bytes from the given array to convertpublic static char firstNonWsCharUc(java.lang.String searchIn)
searchIn
- the string to search inpublic static char firstNonWsCharUc(java.lang.String searchIn, int startAt)
public static char firstAlphaCharUc(java.lang.String searchIn, int startAt)
public static java.lang.String fixDecimalExponent(java.lang.String dString)
dString
- The value as a stringpublic static byte[] getBytes(java.lang.String s, java.lang.String encoding)
s
- source stringencoding
- java encodingpublic static byte[] getBytesWrapped(java.lang.String s, char beginWrap, char endWrap, java.lang.String encoding)
s
- source stringbeginWrap
- opening char delimiterendWrap
- closing char delimiterencoding
- java encodingpublic static int indexOfIgnoreCase(java.lang.String searchIn, java.lang.String searchFor)
searchIn
- the string to search insearchFor
- the array of strings to search forsearchFor
is found within searchIn
starting from startingPosition
.public static int indexOfIgnoreCase(int startingPosition, java.lang.String searchIn, java.lang.String searchFor)
startingPosition
- the position to start the search fromsearchIn
- the string to search insearchFor
- the array of strings to search forsearchFor
is found within searchIn
starting from startingPosition
.public static int indexOfIgnoreCase(int startingPosition, java.lang.String searchIn, java.lang.String[] searchForSequence, java.lang.String openingMarkers, java.lang.String closingMarkers, java.util.Set<StringUtils.SearchMode> searchMode)
Independently of the searchMode
provided, when searching for the second and following strings SearchMode.SKIP_WHITE_SPACE
will
be added and SearchMode.SKIP_BETWEEN_MARKERS
removed.
startingPosition
- the position to start the search fromsearchIn
- the string to search insearchForSequence
- searchForSequenceopeningMarkers
- characters which delimit the beginning of a text block to skipclosingMarkers
- characters which delimit the end of a text block to skipsearchMode
- a Set
, ideally an EnumSet
, containing the flags from the enum StringUtils.SearchMode
that determine the
behavior of the searchsearchFor
is found within searchIn
starting from startingPosition
.public static int indexOfIgnoreCase(int startingPosition, java.lang.String searchIn, java.lang.String searchFor, java.lang.String openingMarkers, java.lang.String closingMarkers, java.util.Set<StringUtils.SearchMode> searchMode)
startingPosition
- the position to start the search fromsearchIn
- the string to search insearchFor
- the string to search foropeningMarkers
- characters which delimit the beginning of a text block to skipclosingMarkers
- characters which delimit the end of a text block to skipsearchMode
- a Set
, ideally an EnumSet
, containing the flags from the enum StringUtils.SearchMode
that determine the
behavior of the searchsearchFor
is found within searchIn
starting from startingPosition
.public static int indexOfIgnoreCase(int startingPosition, java.lang.String searchIn, java.lang.String searchFor, java.lang.String openingMarkers, java.lang.String closingMarkers, java.lang.String overridingMarkers, java.util.Set<StringUtils.SearchMode> searchMode)
startingPosition
- the position to start the search fromsearchIn
- the string to search insearchFor
- the string to search foropeningMarkers
- characters which delimit the beginning of a text block to skipclosingMarkers
- characters which delimit the end of a text block to skipoverridingMarkers
- the subset of openingMarkers
that override the remaining markers, e.g., if openingMarkers = "'("
and
overridingMarkers = "'"
then the block between the outer parenthesis in "start ('max('); end"
is strictly consumed,
otherwise the suffix " end"
would end up being consumed too in the process of handling the nested parenthesis.searchMode
- a Set
, ideally an EnumSet
, containing the flags from the enum StringUtils.SearchMode
that determine the
behavior of the searchsearchFor
is found within searchIn
starting from startingPosition
.public static java.util.List<java.lang.String> split(java.lang.String stringToSplit, java.lang.String delimiter, boolean trim)
stringToSplit
- the string to splitdelimiter
- the string to split ontrim
- should the split strings be whitespace trimmed?java.lang.IllegalArgumentException
- if an error occurspublic static java.util.List<java.lang.String> split(java.lang.String stringToSplit, java.lang.String delimiter, java.lang.String openingMarkers, java.lang.String closingMarkers, boolean trim)
stringToSplit
- the string to splitdelimiter
- the string to split onopeningMarkers
- characters which delimit the beginning of a text block to skipclosingMarkers
- characters which delimit the end of a text block to skiptrim
- should the split strings be whitespace trimmed?java.lang.IllegalArgumentException
- if an error occurspublic static java.util.List<java.lang.String> split(java.lang.String stringToSplit, java.lang.String delimiter, java.lang.String openingMarkers, java.lang.String closingMarkers, boolean trim, java.util.Set<StringUtils.SearchMode> searchMode)
stringToSplit
- the string to splitdelimiter
- the string to split onopeningMarkers
- characters which delimit the beginning of a text block to skipclosingMarkers
- characters which delimit the end of a text block to skiptrim
- should the split strings be whitespace trimmed?searchMode
- a Set
, ideally an EnumSet
, containing the flags from the enum StringUtils.SearchMode
that determine the
behaviour of the searchjava.lang.IllegalArgumentException
- if an error occurspublic static java.util.List<java.lang.String> split(java.lang.String stringToSplit, java.lang.String delimiter, java.lang.String openingMarkers, java.lang.String closingMarkers, java.lang.String overridingMarkers, boolean trim)
stringToSplit
- the string to splitdelimiter
- the string to split onopeningMarkers
- characters which delimit the beginning of a text block to skipclosingMarkers
- characters which delimit the end of a text block to skipoverridingMarkers
- the subset of openingMarkers
that override the remaining markers, e.g., if openingMarkers = "'("
and
overridingMarkers = "'"
then the block between the outer parenthesis in "start ('max('); end"
is strictly consumed,
otherwise the suffix " end"
would end up being consumed too in the process of handling the nested parenthesis.trim
- should the split strings be whitespace trimmed?java.lang.IllegalArgumentException
- if an error occurspublic static java.util.List<java.lang.String> split(java.lang.String stringToSplit, java.lang.String delimiter, java.lang.String openingMarkers, java.lang.String closingMarkers, java.lang.String overridingMarkers, boolean trim, java.util.Set<StringUtils.SearchMode> searchMode)
stringToSplit
- the string to splitdelimiter
- the string to split onopeningMarkers
- characters which delimit the beginning of a text block to skipclosingMarkers
- characters which delimit the end of a text block to skipoverridingMarkers
- the subset of openingMarkers
that override the remaining markers, e.g., if openingMarkers = "'("
and
overridingMarkers = "'"
then the block between the outer parenthesis in "start ('max('); end"
is strictly consumed,
otherwise the suffix " end"
would end up being consumed too in the process of handling the nested parenthesis.trim
- should the split strings be whitespace trimmed?searchMode
- a Set
, ideally an EnumSet
, containing the flags from the enum StringUtils.SearchMode
that determine the
behaviour of the searchjava.lang.IllegalArgumentException
- if an error occurspublic static boolean startsWithIgnoreCase(java.lang.String searchIn, int startAt, java.lang.String searchFor)
searchIn
- the string to search instartAt
- the position to start atsearchFor
- the string to search forpublic static boolean startsWithIgnoreCase(java.lang.String searchIn, java.lang.String searchFor)
searchIn
- the string to search insearchFor
- the string to search forpublic static boolean startsWithIgnoreCaseAndNonAlphaNumeric(java.lang.String searchIn, java.lang.String searchFor)
searchIn
- the string to search insearchFor
- the string to search forpublic static boolean startsWithIgnoreCaseAndWs(java.lang.String searchIn, java.lang.String searchFor)
searchIn
- the string to search insearchFor
- the string to search forpublic static boolean startsWithIgnoreCaseAndWs(java.lang.String searchIn, java.lang.String searchFor, int beginPos)
searchIn
- the string to search insearchFor
- the string to search forbeginPos
- where to start searchingpublic static int startsWithIgnoreCaseAndWs(java.lang.String searchIn, java.lang.String[] searchFor)
searchIn
- the string to search insearchFor
- the string array to search forpublic static byte[] stripEnclosure(byte[] source, java.lang.String prefix, java.lang.String suffix)
source
- bytes to stripprefix
- prefixsuffix
- suffixpublic static java.lang.String toAsciiString(byte[] buffer)
buffer
- the bytes representing the stringpublic static java.lang.String toAsciiString(byte[] buffer, int startPos, int length)
buffer
- the bytes to convertstartPos
- the position to start convertinglength
- the length of the string to convertpublic static boolean wildCompareIgnoreCase(java.lang.String searchIn, java.lang.String searchFor)
searchIn
- the string to search insearchFor
- the string to search for, using the 'standard' SQL wildcard chars of '%' and '_'public static int lastIndexOf(byte[] s, char c)
public static int indexOf(byte[] s, char c)
public static boolean isNullOrEmpty(java.lang.String toTest)
public static java.lang.String stripComments(java.lang.String src, java.lang.String stringOpens, java.lang.String stringCloses, boolean slashStarComments, boolean slashSlashComments, boolean hashComments, boolean dashDashComments)
src
- the source stringstringOpens
- characters which delimit the "open" of a stringstringCloses
- characters which delimit the "close" of a string, in
counterpart order to stringOpens
slashStarComments
- strip slash-star type "C" style commentsslashSlashComments
- strip slash-slash C++ style comments to end-of-linehashComments
- strip #-style comments to end-of-linedashDashComments
- strip "--" style comments to end-of-linepublic static java.lang.String sanitizeProcOrFuncName(java.lang.String src)
src
- the source stringpublic static java.util.List<java.lang.String> splitDBdotName(java.lang.String source, java.lang.String db, java.lang.String quoteId, boolean isNoBslashEscSet)
db
is used in its place and source
corresponds to the full entity name.
If argument source
is NULL or wildcard (%), returns an empty list.source
- the source stringdb
- database, if availablequoteId
- quote character as defined on serverisNoBslashEscSet
- is our connection in no BackSlashEscape modepublic static java.lang.String getFullyQualifiedName(java.lang.String db, java.lang.String entity, java.lang.String quoteId, boolean isPedantic)
db
- database nameentity
- identifierquoteId
- quote character as defined on serverisPedantic
- are we in pedantic modepublic static boolean isEmptyOrWhitespaceOnly(java.lang.String str)
public static java.lang.String escapeQuote(java.lang.String src, java.lang.String quotChar)
public static java.lang.String quoteIdentifier(java.lang.String identifier, java.lang.String quoteChar, boolean isPedantic)
quoteChar
- ` or "identifier
- in pedantic mode (connection property pedantic=true) identifier is treated as unquoted
(as it is stored in the database) even if it starts and ends with quoteChar;
in non-pedantic mode if identifier starts and ends with quoteChar method treats it as already quoted and doesn't modify.isPedantic
- are we in pedantic mode->
null->
`abc`->
`ab``c`->
`ab"c`->
`ab``c` in non-pedantic mode or ```ab````c``` in pedantic mode->
null->
"abc"->
"ab`c"->
"ab""c"->
"ab""c" in non-pedantic mode or """ab""""c""" in pedantic modepublic static java.lang.String quoteIdentifier(java.lang.String identifier, boolean isPedantic)
identifier
- in pedantic mode (connection property pedantic=true) identifier is treated as unquoted
(as it is stored in the database) even if it starts and ends with "`";
in non-pedantic mode if identifier starts and ends with "`" method treats it as already quoted and doesn't modify.isPedantic
- are we in pedantic mode->
null->
`abc`->
`ab``c`->
`ab"c`->
`ab``c` in non-pedantic mode or ```ab````c``` in pedantic modepublic static java.lang.String unQuoteIdentifier(java.lang.String identifier, java.lang.String quoteChar)
identifier
- identifierquoteChar
- ` or "->
null->
abc->
abc->
ab`c->
"ab`c"->
ab"c->
abc->
`ab"c`->
ab`cpublic static int indexOfQuoteDoubleAware(java.lang.String searchIn, java.lang.String quoteChar, int startFrom)
public static java.lang.String toString(byte[] value, int offset, int length, java.lang.String encoding)
public static java.lang.String toString(byte[] value, java.lang.String encoding)
public static java.lang.String toString(byte[] value, int offset, int length)
public static java.lang.String toString(byte[] value)
public static byte[] getBytes(char[] value)
value
- charspublic static byte[] getBytes(char[] c, java.lang.String encoding)
c
- charsencoding
- java encodingpublic static byte[] getBytes(char[] value, int offset, int length)
public static byte[] getBytes(char[] value, int offset, int length, java.lang.String encoding)
value
- charsoffset
- offsetlength
- lengthencoding
- java encodingpublic static byte[] getBytes(java.lang.String value)
public static byte[] getBytes(java.lang.String value, int offset, int length)
public static byte[] getBytes(java.lang.String value, int offset, int length, java.lang.String encoding)
public static final boolean isValidIdChar(char c)
public static void appendAsHex(java.lang.StringBuilder builder, byte[] bytes)
public static void appendAsHex(java.lang.StringBuilder builder, int value)
public static byte[] getBytesNullTerminated(java.lang.String value, java.lang.String encoding)
public static boolean canHandleAsServerPreparedStatementNoCache(java.lang.String sql, ServerVersion serverVersion, boolean allowMultiQueries, boolean noBackslashEscapes, boolean useAnsiQuotes)
public static java.lang.String padString(java.lang.String stringVal, int requiredLength)
public static int safeIntParse(java.lang.String intAsString)
public static boolean isStrictlyNumeric(java.lang.CharSequence cs)
cs
- The CharSequence to check.true
if the CharSequence not empty and contains only digits, false
otherwise.public static java.lang.String safeTrim(java.lang.String toTrim)
public static java.lang.String stringArrayToString(java.lang.String[] elems, java.lang.String prefix, java.lang.String midDelimiter, java.lang.String lastDelimiter, java.lang.String suffix)
elems
- the String array from where to take the elements.prefix
- the prefix of the resulting String.midDelimiter
- the delimiter to be used between the N-1 elementslastDelimiter
- the delimiter to be used before the last element.suffix
- the suffix of the resulting String.public static boolean hasWildcards(java.lang.String src)
src
- stringpublic static java.lang.String getUniqueSavepointId()
public static java.lang.String joinWithSerialComma(java.util.List<?> elements)
elements
- the elements to joinpublic static byte[] unquoteBytes(byte[] bytes)
public static byte[] quoteBytes(byte[] bytes)