public class StringTable
extends java.lang.Object
StringTable
class easy handling of string tables, especially
creating tables from strings and lists. The table constructed is guaranteed
to be complete in that each row has the exact same number of columns and
each table cell is guaranteed to not be null
.Modifier and Type | Method and Description |
---|---|
static StringTable |
fromString(java.lang.String srcString,
java.lang.String delims)
Constructor does the hard work converting the string
Creates a new table from the string, where the fields are separated
by any one of the delimiters.
|
static StringTable |
fromString(java.lang.String srcString,
java.lang.String delims,
boolean preserveEmptyRows)
Constructor does the hard work converting the string
Creates a new table from the string, where the fields are separated
by any one of the delimiters.
|
int |
getCols()
Returns the number of columns in the table.
|
int |
getRows()
Returns the number of rows in the table.
|
java.lang.String[][] |
getTable()
Returns the string table created.
|
StringTable |
transpose()
Transposes the table - cols will be rows and rows will be cols.
|
public static StringTable fromString(java.lang.String srcString, java.lang.String delims)
The string is logically split on CR/LF to get the rows. Each row is then split on the delimiters to get the cells.
Any empty rows in the string table are preserved as empty rows in the resulting table.
srcString
- The string from which to construct the tabledelims
- The delimiters for columns.public static StringTable fromString(java.lang.String srcString, java.lang.String delims, boolean preserveEmptyRows)
The string is logically split on CR/LF to get the rows. Each row is then split on the delimiters to get the cells.
srcString
- The string from which to construct the tabledelims
- The delimiters for columns.preserveEmptyRows
- If true
empty rows in the input
string are added as empty rows in the table. Otherwise empty rows
in the input are ignored.public StringTable transpose()
public java.lang.String[][] getTable()
public int getRows()
public int getCols()
"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"