@FIELDS[["sep_list",]string] : Returns the number of fields in string.

 

The default list of separators for @FIELD, @FIELDS, @WORD and @WORDS consists of space, tab, and comma. You can use the optional first parameter, sep_list, to specify the separators that you wish to use. If you want to use a quote mark as a separator, prefix it with an escape character, e.g., ^". Alphabetic characters in sep_list are case sensitive. If you do not specify a separator list, @FIELD will skip any leading separators.

 

@FIELD and @FIELDS differ from @WORD and @WORDS in how multiple consecutive separators are counted. @WORD and @WORDS consider a sequence as a single separator, and ignore separators at either end of string. In contrast, @FIELD and @FIELDS count each occurrence of a separator individually, including those at either end of string.

 

If string is double quoted, you must specify sep_list.

 

Example:

 

echo %@fields[" ,",Now is the time]

4

 

See also: @WORD, @WORDS, @FIELD.