Returns the number of times the value of a second character expression occurs within the first character expression.
JSV_occurs(expS1, expS2)
expS1.occurs(expS2)
The function occurs returns zero if the string expS2 isn't found in the the string expS1; otherwise, it returns the number of times expS2 occurs within expS1.
The occurs function uses the following arguments.
Argument | Description |
expS1 | This character expression is searched for occurrences of the second character expression expS2. |
expS2 | The character expression for which to search in expS1. |
n/a
The following lines of code
var testString1 = "Quiet feet make little noise on sleek ice", testString2 = "e";
document.write( testString2.bold() +
" occurs " +
JSV_occurs(testString1,testString2) +
" times in " +
testString1.bold() );
produce
Copyright © 1998-2000 Roaring Fork Software. All rights reserved.