Subj : Re: String functions? To : Sampsa From : Tracker1 Date : Sun Feb 08 2015 04:24 pm > I've been dabbling in Synchronet JS lately and noticed that the methods > that Syncro provides seem to be a subset of those in the standard. > > For example, there is no trim() method. > > My immediate question is - how do I trim whitespace from a string like > trim() does? > > Is there a separate string handling object or something? String.prototype.trim = String.prototype.trim || function() { return this.replace(/^\s+|\s+$/,''); }; I'm not sure which version of Spidermonkey Synchronet now uses, but it's been in there for several years now.. it was added to JS as part of ECMAScript 5. You can probably snag the ES5 SHIMS, and load that at the top of a common include in your login/logon script. -- Michael J. Ryan http://tracker1.info/ .