Determines the length of the list. If no delimiter is specified, the listLen function splits the string using a comma (',') as the delimiter.
JSV_listLen(expL [, delimiter])
expL.listLen([delimiter])
Returns length of the list (i.e., the number of elements in the list). Returns 0 if the string is empty.
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. |
n/a
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
Copyright © 1998-2000 Roaring Fork Software. All rights reserved.