How to find number of dots from string using Javascript
Find number of dots from string using javascript
By using this function we can get the no of repeated character from the string using java script.function count(s1, letter) { return s1.match( new RegExp(letter,'g') ).length; }Example 1:
count('Yes. I want. to. place a. lot of. dots.','\\.'); //=> output : 6Example 2:
count('2....3','\\.'); //=> output : 4
0 comments:
Post a Comment
Please provide your valuable comment.