Door Games Unlimited

Welcome, Guest.


Subject: Re: String functions? Date: Sun Feb 08 2015 16:24:49
From: Tracker1 To: Sampsa

 > 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/

---
 ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ telnet://vert.synchro.net

Previous Message       Next Message
In Reply To: String functions? (Sampsa)
Replies: Re: String functions? (Sampsa)