public class TclList
extends Object
implements Serializable, Cloneable
The ListBuilder class has better performance and is more convenient for creating lists.
Constructor and Description |
---|
TclList()
construct an empty list
|
TclList(String s)
construct a list from a String value
|
Modifier and Type | Method and Description |
---|---|
String |
join()
return the string representation of your list created from
joining the elements.
|
String |
join(String separator)
Join using a specified separator string.
|
void |
lappend(String e)
add an element to the list end
|
void |
lappend(String e1,
String e2)
add 2 elements to the list end
|
void |
lappend(String e1,
String e2,
String e3)
add 3 elements to the list end
|
void |
lappend(String e1,
String e2,
String e3,
String e4)
add 4 elements to the list end
|
int |
length()
Return the count of list elements.
|
String |
lindex(int n)
Retrieve an element from a list, indexing starts with 0.
|
static String |
lindex(String s,
int n)
Parse a list and return an element, indexing starts with 0.
|
void |
linsert(String e,
int index)
Insert an element at index N, sliding existing elements +1.
|
static String |
listElement(String s,
int n)
Parse a list and return an element, indexing starts with 0.
|
static String |
listElement(String s,
int i,
int j)
Parse a nested list - the ith element is parsed as a list for
the jth item.
|
static String |
listElement(String s,
int index1,
int index2,
int index3)
Parse a double nested list for an element.
|
int |
llength()
Return the count of list elements
|
void |
remove(int index)
remove a single element from the list
|
void |
remove(int[] indexes)
remove multiple elements
|
void |
replace(int index,
String element)
Replace a single element in a list.
|
String[] |
split()
split a list into elements
|
static String[] |
split(String s)
split the input list into elements
|
String |
toString() |
public TclList()
public TclList(String s)
public String join()
public String join(String separator)
public void lappend(String e) throws ListFormatException
ListFormatException
public void lappend(String e1, String e2) throws ListFormatException
ListFormatException
public void lappend(String e1, String e2, String e3) throws ListFormatException
ListFormatException
public void lappend(String e1, String e2, String e3, String e4) throws ListFormatException
ListFormatException
public int length()
public String lindex(int n) throws ListFormatException
ListFormatException
- if the text is not a proper list.public static String lindex(String s, int n) throws ListFormatException
ListFormatException
- if the text is not a proper list.public void linsert(String e, int index) throws ListFormatException
ListFormatException
public static String listElement(String s, int n) throws ListFormatException
ListFormatException
- if the text is not a proper list.public static String listElement(String s, int i, int j) throws ListFormatException
ListFormatException
- if the text is not a proper list.public static String listElement(String s, int index1, int index2, int index3) throws ListFormatException
ListFormatException
- if the text is not a proper list.public int llength() throws ListFormatException
ListFormatException
- if the text is not a proper list.public void remove(int index) throws ListFormatException
ListFormatException
- if the text is not a proper list.public void remove(int[] indexes) throws ListFormatException
ListFormatException
- if the text is not a proper list.public void replace(int index, String element) throws ListFormatException
ListFormatException
- if the text is not a proper list.public String[] split() throws ListFormatException
ListFormatException
- if the text is not a proper list.public static String[] split(String s) throws ListFormatException
ListFormatException
- if the text is not a proper list.public String toString()
toString
in class Object