.count()

Method that returns the number of occurances of a certain string in the string.

Note: This method is case sensitive.

The method .count() is located in the file string.jsxinc.

Usage

To check for a certain string:

var mystring = "The quick brown fox jumps over the lazy dog";
var numberofoccurances = mystring.count("a");

To check case insensitive:

var mystring = "The quick brown fox jumps over the lazy dog";
var search = "a";
var numberofoccurances = mystring.toLowerCase().count(search.toLowerCase());

Parameter

Parameter Data type Required Description
s1 String The string to count.

Return Values

Value Meaning
number The number of occurances.