﻿String.prototype.EndsWith = function(str) { return (this.match(str + '$') != null); }; String.prototype.StartsWith = function(str) { return (this.match('^' + str) != null); }; String.prototype.Trim = function() { return (this.replace(/^[\s\xA0]+/, "").replace(/[\s\xA0]+$/, "")); }; String.prototype.ReplaceString = function(oldString, newString) { var reg = new RegExp(oldString, 'ig'); return (this.replace(reg, newString)); }; String.prototype.CountCharOf = function(c) { var count = 0; for (var i = 0; i < this.length; i++) { if (this.charAt(i) == c) { count += 1; } } return count; }