Core Docs | Additional Modules Docs

String.prototype.substrCount


@Description: Returns the numbers of times a substring is found in a string
@File: String/prototype/substrCount.js
@Author: Paul Visco
@Version: 1.1 11/19/07 09/18/08
@Param: String needle The substring to search for within the string
@Return: Number The number of times the substring is found in the original string
@Example:
var myString = 'hello world on earth';

var answer = myString.substrCount('world');
//answer = 1;