Determines the length of the list. If no delimiter is specified, the listLen function splits the string using a comma (',') as the delimiter.

Syntax

JSV_listLen(expL [, delimiter])

Prototype

expL.listLen([delimiter])

Returns

Returns length of the list (i.e., the number of elements in the list). Returns 0 if the string is empty.

Parameters

The listLen function uses the following arguments.

Argument Description
expL Delimited list being searched.
delimiter Optional. Single delimiter used in string. Default value is a comma.

Remarks

n/a

Dependencies

JSV_isWhitespace, JSV_occurs

Example

The following lines of code

var myList= "1,2,3,4,5,6,7";
document.write( myList.bold() + " contains " + JSV_listLen(myList, ',') + " elements" );
document.write( JSV_br() );
var myList= "1234567";
document.write( myList.bold() + " contains " + JSV_listLen(myList,',') + " elements" );
document.write( JSV_br() );
var myList= "";
document.write( myList.bold() + " contains " + JSV_listLen(myList,',') + " elements" );
document.write( JSV_br() );

produce