From 312e7cb7a84b71c25e9a88a7bccbab2b8785482c Mon Sep 17 00:00:00 2001 From: euzuro Date: Thu, 18 May 2006 13:06:26 +0000 Subject: [PATCH] JSDOC / codingstandards for Array/String extention functions git-svn-id: http://svn.openlayers.org/trunk/openlayers@142 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Util.js | 66 +++++++++++++++++++++++++++++++++--------- 1 file changed, 53 insertions(+), 13 deletions(-) diff --git a/lib/OpenLayers/Util.js b/lib/OpenLayers/Util.js index c850b3fe44..4cceebd12b 100644 --- a/lib/OpenLayers/Util.js +++ b/lib/OpenLayers/Util.js @@ -448,22 +448,50 @@ OpenLayers.Bounds.fromString = function(str) { String.prototype.startsWith = function(sStart){ return (this.substr(0,sStart.length) == sStart); }; + +/** +* @returns A trimmed version of the string - all leading and +* trailing spaces removed +* @type String +*/ String.prototype.trim = function() { - var b=0,e=this.length -1; - while(this.substr(b,1) == " ") {b++;} - while(this.substr(e,1) == " ") {e--;} - return this.substring(b,e+1); + + var b = 0; + while(this.substr(b,1) == " ") { + b++; + } + + var e = this.length - 1; + while(this.substr(e,1) == " ") { + e--; + } + + return this.substring(b, e+1); }; -Array.prototype.remove = function(rem) { - for(var i=0; i