List Functions

Previous  Terms  Next

TinkerPlots_logoV2-rgb


List Functions

firstitem

firstitem(list, delimiters) returns the first item in the list passed as its first argument, using the characters in its optional second argument as delimiters. The delimiter defaults to the list separator for the current region, usually a comma.

Examples: firstItem("a,b,c") returns "a" when comma is the regional list separator; firstItem("Jane Doe" , "") returns "Jane". firstItem("HTHHT" , "") returns "H" because all characters are items when there are no delimiters.

itemCount

itemCount(list, delimiters) returns the number of items in the list passed as its first argument, using the characters in its optional second argument as delimiters. The delimiter defaults to the list separator for the current region, usually a comma.

Examples: itemCount("a,b,c") returns 3 when comma is the regional list separator; itemCount("JAN/1/2006" , "/") returns "3"; itemCount ("HTHHT" , "") returns 5 because all characters are items when there are no delimiters.

itemSum

itemSum(list, delimiters) returns the sum of the items in the list passed as its first argument, using the characters in its optional second argument as delimiters. The delimiter defaults to the list separator for the current region, usually a comma.

Examples: itemSum("1,2,3") returns 6 when comma is the regional list separator; itemSum("1234" , "") returns 10 because all characters are items when there are no delimiters.

lastItem

lastItem(list, delimiters) returns the last item in the list passed as its first argument, using the characters in its optional second argument as delimiters. The delimiter defaults to the list separator for the current region, usually a comma.

Examples: lastItem("a,b,c") returns "c" when comma is the regional list separator; lastItem("Jane Doe" , "") returns "Doe"; lastItem("HTHHT" , "") returns "T" because all characters are items when there are no delimiters.

matchCount

matchCount(list, match, delimiters) returns the number of items matching its second argument in the list passed as its first argument, using the characters in its optional third argument as delimiters. The delimiter defaults to the list separator for the current region, usually a comma.

Examples: matchCount("2,6,3,4,3" , 3) returns 2 when comma is the regional list separator; matchCount("T;H;T;T;H" , "H", ";" returns 2; matchCount("HTHHT" , "H", "") returns 3 because all characters are items when there are no delimiters.

matchPattern

matchPattern(list, pattern, listDelimiters, patternDelimiters) returns true if the items of the list match the pattern, which can include wildcards "*"(any), "-"(any unused), Variables "V1" ..."Vn", and optionally start with "U:"(unordered), using the characters in its optional third and fourth arguments as delimiters. The delimiter defaults to the list separator for the current region, usually a comma.

Examples: matchPattern("1,4,2", "1,<*>,<*>") returns true when comma is the regional list separator; matchPattern("THTTH", "U:H,H,T,T,T", ",","") returns true.

nthItem

nthItem(list, n, delimiters) returns the item at index n in the list passed as its first argument, using the characters in its optional third argument as delimiters. The delimiter defaults to the list separator for the current region, usually a comma.

Examples: nthItem("a,b,c", 1) returns "a" when comma is the regional list separator; nthItem("JAN/1/2006" , 3, "/") returns "2006".

sortItems

sortItems(list, delimiters) sorts the items in the list passed as its first argument, using the characters in its optional second argument as delimiters. The delimiter defaults to the list separator for the current region, usually a comma.

Examples: sortItems("2,16,3,4,3") returns "2,3,3,4,16" when comma is the regional list separator; sortItems("{T;H;12;2;t;h}", "{;}") returns "{2;12;H;h;T;t}"; sortItems(HTHHT" , "") returns "HHHTT", because all characters are items when there are no delimiters.

 


TinkerPlots Help

© 2012 Clifford Konold and Craig D. Miller