public class StringUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
equals(String str1,
String str2) |
static void |
escapeAndWriteDelimitedColumn(String str,
char delimiter,
boolean addQuotes,
Map<String,String> replace,
Writer writer)
Escapes a column in a delimited file and writes a quoted string directly
to a
Writer. |
static void |
escapeAndWriteDelimitedColumn(String str,
char delimiter,
boolean addQuotes,
Writer writer)
Escapes a column in a delimited file and writes a quoted string directly
to a
Writer. |
static void |
escapeAndWriteDelimitedColumn(String str,
char delimiter,
Map<String,String> replace,
Writer writer)
Escapes a column in a delimited file and writes it directly to a
Writer. |
static void |
escapeAndWriteDelimitedColumn(String str,
char delimiter,
Writer writer)
Escapes a column in a delimited file and writes it directly to a
Writer. |
static void |
escapeAndWriteDelimitedColumns(List<String> columnValues,
char delimiter,
Writer writer) |
static void |
escapeAndWriteDelimitedColumns(List<String> columnValues,
Map<String,String> replace,
char delimiter,
Writer writer) |
static void |
escapeAndWriteDelimitedColumns(String[] columnValues,
char delimiter,
Writer writer) |
static void |
escapeAndWriteDelimitedColumns(String[] columnValues,
Map<String,String> replace,
char delimiter,
Writer writer) |
static String |
escapeDelimitedColumn(String str,
char delimiter)
Escapes a column in a delimited file.
|
static List<String> |
escapeDelimitedColumns(List<String> columnValues,
char delimiter) |
static List<String> |
escapeDelimitedColumns(List<String> columnValues,
Map<String,String> replace,
char delimiter) |
static String[] |
escapeDelimitedColumns(String[] columnValues,
char delimiter) |
static String[] |
escapeDelimitedColumns(String[] columnValues,
Map<String,String> replace,
char delimiter) |
static void |
escapeDelimitedColumnsInPlace(List<String> columnValues,
char delimiter) |
static void |
escapeDelimitedColumnsInPlace(List<String> columnValues,
Map<String,String> replace,
char delimiter) |
static void |
escapeDelimitedColumnsInPlace(String[] columnValues,
char delimiter) |
static void |
escapeDelimitedColumnsInPlace(String[] columnValues,
Map<String,String> replace,
char delimiter) |
static boolean |
getEmptyOrNull(String str)
Returns whether the given string is
null, of length 0, or
contains just whitespace. |
public static boolean getEmptyOrNull(String str)
null, of length 0, or
contains just whitespace.str - a String.true if the string is null, of length
0, or contains just whitespace; false otherwise.public static List<String> escapeDelimitedColumns(List<String> columnValues, char delimiter)
public static List<String> escapeDelimitedColumns(List<String> columnValues, Map<String,String> replace, char delimiter)
public static void escapeDelimitedColumnsInPlace(List<String> columnValues, char delimiter)
public static void escapeDelimitedColumnsInPlace(List<String> columnValues, Map<String,String> replace, char delimiter)
public static String[] escapeDelimitedColumns(String[] columnValues, char delimiter)
public static String[] escapeDelimitedColumns(String[] columnValues, Map<String,String> replace, char delimiter)
public static void escapeDelimitedColumnsInPlace(String[] columnValues, char delimiter)
public static void escapeDelimitedColumnsInPlace(String[] columnValues, Map<String,String> replace, char delimiter)
public static void escapeAndWriteDelimitedColumns(String[] columnValues, char delimiter, Writer writer) throws IOException
IOExceptionpublic static void escapeAndWriteDelimitedColumns(String[] columnValues, Map<String,String> replace, char delimiter, Writer writer) throws IOException
IOExceptionpublic static void escapeAndWriteDelimitedColumns(List<String> columnValues, char delimiter, Writer writer) throws IOException
IOExceptionpublic static void escapeAndWriteDelimitedColumns(List<String> columnValues, Map<String,String> replace, char delimiter, Writer writer) throws IOException
IOExceptionpublic static void escapeAndWriteDelimitedColumn(String str, char delimiter, Map<String,String> replace, Writer writer) throws IOException
Writer. This is somewhat more efficient than
escapeDelimitedColumn(java.lang.String, char) because it does
less temporary object creation. The performance difference will become
more apparent when writing large delimited files.str - a column String.delimiter - the file's delimiter character.replace - a map. Replaces any keys that are found with the
corresponding values.writer - the Writer to which to write the escaped column.IOException - if an error writing to writer occurs.public static void escapeAndWriteDelimitedColumn(String str, char delimiter, Writer writer) throws IOException
Writer. This is somewhat more efficient than
escapeDelimitedColumn(java.lang.String, char) because it does
less temporary object creation. The performance difference will become
more apparent when writing large delimited files.str - a column String. If null, the string
NULL will be written out. If you want to write out something
different when a null is encountered, use
escapeAndWriteDelimitedColumn(java.lang.String, char, java.util.Map, java.io.Writer)
and specify a replacement.delimiter - the file's delimiter character.writer - the Writer to which to write the escaped column.IOException - if an error writing to writer occurs.public static void escapeAndWriteDelimitedColumn(String str, char delimiter, boolean addQuotes, Writer writer) throws IOException
Writer. This is somewhat more efficient than
escapeDelimitedColumn(java.lang.String, char) because it does
less temporary object creation. The performance difference will become
more apparent when writing large delimited files.str - a column String. If null, the string
NULL will be written out. If a quote is part of the string,
it will be escaped by a second quote (my"Str will be written out as
"my""Str"). If not, the string will be surrounded with quotes and written
out (myStr will be written out as "myStr").delimiter - the file's delimiter character.addQuotes - whether or not to surround the surround the column by
quotes.writer - the Writer to which to write the escaped column.IOException - if an error writing to writer occurs.public static void escapeAndWriteDelimitedColumn(String str, char delimiter, boolean addQuotes, Map<String,String> replace, Writer writer) throws IOException
Writer. This is somewhat more efficient than
escapeDelimitedColumn(java.lang.String, char) because it does
less temporary object creation. The performance difference will become
more apparent when writing large delimited files.str - a column String. If null, the string
NULL will be written out. If a quote is part of the string,
it will be escaped by a second quote (my"Str will be written out as
"my""Str"). If not, the string will be surrounded with quotes and written
out (myStr will be written out as "myStr").delimiter - the file's delimiter character.addQuotes - whether or not to surround the surround the column by
quotes.replace - a map. Replaces any keys that are found with the
corresponding values.writer - the Writer to which to write the escaped column.IOException - if an error writing to writer occurs.Copyright © 2012–2020 Emory University. All rights reserved.