List Functions

Top  Previous  Next

Fathom Reference > Fathom Operators, Functions, and Units > List Functions

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 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(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 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(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(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 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(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 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.

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 comma.

Examples: nthItem("a,b,c", 1) returns "a" when comma is the regional list separator; nthItem("January 1, 2006", 3, ", ") returns "2006"; nthItem("HTHHT", 4, "") returns "H" because all characters are items when there are no delimiters.

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 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.