In Javascript is there a function that returns the number of times that a given string occurs?
Posted
by William Calleja
on Stack Overflow
See other posts from Stack Overflow
or by William Calleja
Published on 2010-03-24T14:54:39Z
Indexed on
2010/03/24
15:03 UTC
Read the original article
Hit count: 281
JavaScript
|string-manipulation
In Javascript is there a function that returns the number of times that a given string occurs? I need to return a numeric value that is equal to the number of times that a given string occurs within a particular string for instance:
var myString = "This is a test text"
If I had to search for 'te
' in the above string it would return 2.
© Stack Overflow or respective owner