public class StringUtil extends Object
Constructor and Description |
---|
StringUtil() |
Modifier and Type | Method and Description |
---|---|
static String |
escapeAndQuote(String str)
Escapes the input string and surrounds it with single quotes.
|
static String |
escapeFieldName(String name)
Escapes a field name, for use in the expression language.
|
static String |
formatFieldName(String name)
Formats a field name for printing to the console or GUI.
|
static String |
getTypeName(String packageStyleType)
Gets the unqualified type name from a fully qualified type name.
|
static String |
join(Iterable<?> values)
Concatenates string values together using a comma followed by a space.
|
static String |
join(Object[] values)
Concatenates string values together using a comma followed by a space.
|
static String |
join(String separator,
Iterable<?> values)
Concatenates string values together using a separator.
|
static String |
join(String separator,
Object[] values)
Concatenates string values together using a separator.
|
static String[] |
parseCSV(String data)
Parses a comma-separated list into an array of strings.
|
static String[] |
split(String data,
char delimiter)
Splits incoming String data into an array of substrings based on a character delimiter.
|
static String |
toCSV(Collection<String> values)
Create a csv from a list of strings
|
static String |
unescapeAndQuote(String str)
Removes a single layer of matched leading and trailing quotes, and also unescapes JavaScript style escape
sequences.
|
public static String escapeAndQuote(String str)
This method should not be used for field names; instead, use
formatFieldName(String)
.
str
- the string to escape and quotepublic static String unescapeAndQuote(String str)
str
- the string to unquote and unescapepublic static String formatFieldName(String name)
name
- the field name to formatpublic static String escapeFieldName(String name)
name
- the field name to escapepublic static String getTypeName(String packageStyleType)
"com.acme.Foo"
would result in "Foo"
.packageStyleType
- the fully qualified type name in dot notationpublic static String join(String separator, Iterable<?> values)
Iterator
of values
. Objects in values
that are not strings are converted to strings via
their Object.toString()
method.separator
- the separator to use between string valuesvalues
- the values to concatenatevalues
joined by separator
into a single stringpublic static String join(Iterable<?> values)
Iterator
of values
. Objects in values
that are not strings are converted to
strings via their Object.toString()
method.
This method is equivalent to join(", ", values)
.
values
- the values to concatenatevalues
joined by ", " into a single stringpublic static String join(String separator, Object[] values)
values
that are not strings are
converted to strings via their Object.toString()
method.separator
- the separator to use between string valuesvalues
- the values to concatenatevalues
joined by separator
into a single stringpublic static String join(Object[] values)
values
that are not
strings are converted to strings via their Object.toString()
method.
This method is equivalent to join(", ", values)
.
values
- the values to concatenatevalues
joined by ", " into a single stringpublic static final String[] split(String data, char delimiter)
data
- the string to splitdelimiter
- the character separating elementspublic static String[] parseCSV(String data)
data
- public static String toCSV(Collection<String> values)
values
- the valuesCopyright © 2024 Actian Corporation. All rights reserved.