Subj : Re: String functions?
To   : Tracker1
From : Sampsa
Date : Mon Feb 09 2015 03:27 pm

-=> Tracker1 wrote to Sampsa <=-

Tr> @VIA: VERT
Tr> @MSGID: <[email protected]>
Tr> @REPLY: <[email protected]>
Tr> @TZ: 41e0
> 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?

Tr> String.prototype.trim = String.prototype.trim || function() {
Tr>   return this.replace(/^\s+|\s+$/,'');
Tr> };

Tr> I'm not sure which version of Spidermonkey Synchronet now uses, but
Tr> it's been in there for several years now.. it was added to JS as part
Tr> of ECMAScript 5. You can probably snag the ES5 SHIMS, and load that at
Tr> the top of a common include in your login/logon script.

I upgrade to 3.15 and the core JS string functions are now there.

BTW, what I was working on is a door menu to BBS Interlink (www.bbslink.net)
which is a really
cool game server (I don't run it, just a happy user) and I replaced my whole
door menu with a bit
of JS that looks like Synchronet menu but connects out to their server for each
door.

I like the idea of a central door server for multi-user games, figured there'd
be more players.

sampsa


... MultiMail, the new multi-platform, multi-format offline reader!
--- MultiMail/Darwin v0.49
� Synchronet � B4BBS = London, England - b4bbs.sampsa.com:2323 (telnet) or 2222 (ssh)