The stringList class provides a list of strings. More...
| stringList() | |
| stringList(stringList list) | |
| void | append(string item) |
| string | at(int pos) |
| void | clear() |
| bool | contains(string item) |
| string | findMostSimilar(string target) |
| int | indexOf(string search, int start=0) |
| void | insert(int pos, string value) |
| string | join(string separator) |
| void | prepend(string value) |
| int | removeAll(string item) |
| void | removeAt(int pos) |
| int | size() |
| void | set(int pos, string item) |
| void | sortList(int style=0) |
| void | swap(int pos1, int pos2) |
A stringList is a dynamic list of string values. string split builds one from a separator; process getCommandlineParameter returns the arguments the LayoutEditor was started with; drawingField findCellRegExp returns matching cell names. append, prepend, insert, and set edit entries; join concatenates them with a separator (which may be empty). Index 0 is the first item; size is the count; set has no effect if pos is past the end. contains, indexOf, and findMostSimilar search; sortList orders the list. In Python this class maps to a native list of strings.
Example:
stringList sl;
sl.append("metal1");
sl.append("via");
sl.append("metal2");
string joined = sl.join(",");
int i = sl.indexOf("via");
if (i >= 0)
sl.set(i, "via1");
Creates a new empty list of strings.
Creates a new list of strings with a copy of list.
Inserts item at the end of the list.
Returns: the string at index pos. The first entry is 0.
Removes all items from the list.
Returns: true if the list contains item, otherwise false.
Returns: the string in the list that is most similar to target. (introduced with release 20260423)
Returns: the index of the first occurrence of search, searching forward from start. Returns -1 if search is not found.
| Parameter: | |
|---|---|
| search | search |
| start | start |
Inserts value at pos. Later items move one position.
| Parameter: | |
|---|---|
| pos | pos |
| value | value |
Joins every string in the list into one string, with separator between items. separator may be empty.
Returns: the concatenated string.
Inserts value at the beginning of the list.
Removes every occurrence of item.
Returns: the number of entries removed.
Removes the entry at pos. The list shrinks by one.
Returns: the number of strings in the list.
Sets entry pos to item. The first entry is 0. Has no effect if the list is shorter than pos.
| Parameter: | |
|---|---|
| pos | pos |
| item | item |
Sorts the list. style chooses the order:
| Values: | Alignment: |
|---|---|
| 0 | case insensitive |
| 1 | case sensitive |
| 10 | by integer value (e.g. 1, 4, 8, 12, 34, 765 ) |
(introduced with release 20201224)
Swaps the values at pos1 and pos2.