Quantcast
Channel: How to count string occurrence in string? - Stack Overflow
Viewing all articles
Browse latest Browse all 43

Answer by Fad Seck for How to count string occurrence in string?

$
0
0

String.prototype.Count = function (find) {    return this.split(find).length - 1;}console.log("This is a string.".Count("is"));

This will return 2.


Viewing all articles
Browse latest Browse all 43

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>