Javascript String countLeadingSpaces()
countLeadingSpaces()
String.prototype.countLeadingSpaces = function() { var a = this.match(/^\s*/); if (a != null && a.length > 0 && a[0].isString) return a[0].length; } //eof//from w ww . j a v a 2 s . c om