eXtreme Development

Javascript - implementacao funcoes trim() e replaceAll()

String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g, '');
};
String.prototype.replaceAll = function(find, replace) {
  return this.replace(new RegExp(find, 'g'), replace);
};

Referencias

http://stackoverflow.com/questions/498970/trim-string-in-javascript



SourceForge BootStrap