Node.js examples for String:Char
Count chars in a String
String.prototype.countChars = function( chr ) { for( var i = count = 0; i < this.length; i++ ) { if( this.charAt( i ) === chr ) { count++;/*w ww. ja v a 2 s . co m*/ } } return count; }