fieldCount

fieldCount, function

def pure fieldCount(haystack: text, separator: text): number

Returns the number of fields separated by separator in haystack.

Examples

haystack = "a-b-c"
separator = "-"

count = fieldCount(haystack, separator)

table S = with
  [| as Count |]
  [| count |]

show table "Field count" with
  S.Count

This produces the following table:

Count
3

Errors

separator cannot be empty.

Remarks

fieldCount is case-sensitive.

See also

User Contributed Notes
0 notes + add a note