public class StringUtil
extends java.lang.Object
| Modifier and Type | Field | Description |
|---|---|---|
private static char[] |
hex_table |
| Constructor | Description |
|---|---|
StringUtil() |
| Modifier and Type | Method | Description |
|---|---|---|
static java.lang.String |
compressQuotes(java.lang.String source,
java.lang.String quotes) |
Compress 2 adjacent (single or double) quotes into a single (s or d)
quote when found in the middle of a String.
|
private static java.lang.String |
doRegExpA(java.lang.String src,
java.lang.String indent) |
Reg.exp substitute:
|
private static java.lang.String |
doRegExpB(java.lang.String src) |
Reg.exp substitute:
|
private static java.lang.String |
doRegExpC(java.lang.String src,
java.lang.String indent) |
Reg.exp substitute:
|
static java.lang.String |
ensureIndent(java.lang.String formatted,
int depth) |
Utility for formatting which bends a multi-line string into shape for
outputting it in a context where there is depth tabs.
|
static java.lang.String |
formatForPrint(java.lang.String input) |
Used to print out a string for error messages,
chops is off at 60 chars for historical reasons.
|
static byte[] |
fromHexString(java.lang.String s,
int offset,
int length) |
Convert a hexidecimal string generated by toHexString() back
into a byte array.
|
static byte[] |
getAsciiBytes(java.lang.String input) |
Get 7-bit ASCII character array from input String.
|
static java.lang.String |
hexDump(byte[] data) |
Convert a byte array to a human-readable String for debugging purposes.
|
static java.lang.String |
normalizeSQLIdentifier(java.lang.String id) |
Normalize a SQL identifer, up-casing if
|
(package private) static java.lang.String |
quoteString(java.lang.String source,
char quote) |
Quote a string so that it can be used as an identifier or a string
literal in SQL statements.
|
static java.lang.String |
quoteStringLiteral(java.lang.String string) |
Quote a string so that it can be used as a string literal in an
SQL statement.
|
static java.lang.String |
shortDBName(java.lang.String canonicalDBName,
char separatorChar) |
Get the short database name from the canonical name.
|
static java.lang.String |
slice(java.lang.String value,
int beginOffset,
int endOffset,
boolean trim) |
Return a slice (substring) of the passed in value, optionally trimmed.
|
static boolean |
SQLEqualsIgnoreCase(java.lang.String s1,
java.lang.String s2) |
Compares two strings
Strings will be uppercased in english and compared
equivalent to s1.equalsIgnoreCase(s2)
throws NPE if s1 is null
|
static java.lang.String |
SQLToUpperCase(java.lang.String s) |
Convert string to uppercase
Always use the java.util.ENGLISH locale
|
static java.lang.String |
toHexString(byte[] data,
int offset,
int length) |
Convert a byte array to a String with a hexidecimal format.
|
static java.lang.String[] |
toStringArray(java.lang.Object[] objArray) |
A method that receive an array of Objects and return a
String array representation of that array.
|
static java.lang.String |
trimTrailing(java.lang.String str) |
Trim off trailing blanks but not leading blanks
|
static java.lang.String |
truncate(java.lang.String value,
int length) |
Truncate a String to the given length with no warnings
or error raised if it is bigger.
|
public static final java.lang.String formatForPrint(java.lang.String input)
public static java.lang.String[] toStringArray(java.lang.Object[] objArray)
public static byte[] getAsciiBytes(java.lang.String input)
public static java.lang.String trimTrailing(java.lang.String str)
str - public static java.lang.String truncate(java.lang.String value,
int length)
value - String to be truncatedlength - Maximum length of stringpublic static java.lang.String slice(java.lang.String value,
int beginOffset,
int endOffset,
boolean trim)
value - Value to slice, must be non-null.beginOffset - Inclusive start characterendOffset - Inclusive end charactertrim - To trim or not to trimpublic static java.lang.String toHexString(byte[] data,
int offset,
int length)
b & 0xf0), the second character
represents the low nibble (b &xs; 0x0f).
data[offset] is represented by the first two characters in the returned String.data - byte arrayoffset - starting byte (zero based) to convert.length - number of bytes to convert.public static byte[] fromHexString(java.lang.String s,
int offset,
int length)
s - String to convertoffset - starting character (zero based) to convert.length - number of characters to convert.public static java.lang.String hexDump(byte[] data)
public static java.lang.String SQLToUpperCase(java.lang.String s)
s - string to uppercasepublic static boolean SQLEqualsIgnoreCase(java.lang.String s1,
java.lang.String s2)
s1 - first string to compares2 - second string to comparepublic static java.lang.String normalizeSQLIdentifier(java.lang.String id)
id - syntacically correct SQL identifierpublic static java.lang.String compressQuotes(java.lang.String source,
java.lang.String quotes)
source - string to be compressedquotes - string containing two single or double quotes.static java.lang.String quoteString(java.lang.String source,
char quote)
source - the string to quotequote - the character to quote the string with (' or ")quoteStringLiteral(String),
IdUtil.normalToDelimited(String)public static java.lang.String quoteStringLiteral(java.lang.String string)
string - the string to quotepublic static java.lang.String ensureIndent(java.lang.String formatted,
int depth)
Replace "^[\t]*" with "depth" number of tabs.
Replace "\n+$" with "".
Replace all "\n[\t]*" with "\n" + "depth" number of tabs.
formatted - string to sanitizedepth - indentation level the string is to be printed at (0,1,2..)private static java.lang.String doRegExpA(java.lang.String src,
java.lang.String indent)
src - source string in which to substitute indentindent - indentation to lead sourceprivate static java.lang.String doRegExpB(java.lang.String src)
src - source string in which to substituteprivate static java.lang.String doRegExpC(java.lang.String src,
java.lang.String indent)
src - source string in which to substitute indentindent - indentation to lead sourcepublic static java.lang.String shortDBName(java.lang.String canonicalDBName,
char separatorChar)
Apache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.