Node.js examples for String:Trim
Right trim an array with for loop
String.prototype.rTrim = function(){ str = this;/*from w w w . ja v a2 s .com*/ var i; for(i=str.length-1;i>=0;i--) { if(str.charAt(i)!=" "&&str.charAt(i)!=" ")break; } str=str.substring(0,i+1); return str; }