• String functions?

    From Sampsa@VERT/B4BBS to All on Wed Jan 28 15:03:42 2015
    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?ããã---ã þ Synchronet þ B4BBS = London, England - b4bbs.sampsa.com:2323 (telnet) or 2222 (ssh)ã
  • From Digital Man@VERT to Sampsa on Wed Jan 28 17:20:08 2015
    Re: String functions?ã By: Sampsa to All on Wed Jan 28 2015 03:03 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.ããIt appears you're running Synchronet v3.15b, which uses an older version of the ãMozilla-JavaScript engine (SpiderMonkey). Upgrade to v3.16a (The currently ãdevelopment build) and you'll get a much newer JavaScript engine as well.ãã > For example, there is no trim() method.ããThere very well might be in the newer JavaScript engine.ãã > 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" is the standard JavaScript object for handling strings.ããSynchronet also includes some C-like global functions for string handling, like ã"truncsp" for truncating white-space off the end of a string:ãhttp://synchro.net/docs/jsobjs.htmlãã digital manããSynchronet "Real Fact" #38:ãSynchronet first supported Windows NT v6.x (a.k.a. Vista/Win7) w/v3.14a (2006).ãNorco, CA WX: 67.6øF, 46.0% humidity, 8 mph WSW wind, 0.00 inches rain/24hrsã---ã þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.netã
  • From Khelair@VERT/TINFOIL to Digital Man on Thu Jan 29 09:09:50 2015
    Re: String functions?ã By: Digital Man to Sampsa on Wed Jan 28 2015 17:20:08ãã DM> It appears you're running Synchronet v3.15b, which uses an older versionã DM> of the Mozilla-JavaScript engine (SpiderMonkey). Upgrade to v3.16a (Theã DM> currently development build) and you'll get a much newer JavaScript engineã DM> as well.ãã Ah, yes, I was going to ask about this. Now that I'm delving into file IO;ãthe File object is the one that was proposed for SpiderMonkey that I'veãgoogled, no?ãã-=-ãBorg Burger: We do it our way; your way is irrelevant.ãã---ã þ Synchronet þ Tinfoil Tetrahedron BBS telnet://tinfoil.synchro.netã
  • From Digital Man@VERT to Khelair on Thu Jan 29 14:41:42 2015
    Re: JavaScript functionalityã By: Khelair to Digital Man on Thu Jan 29 2015 09:09 amãã > Re: String functions?ã > By: Digital Man to Sampsa on Wed Jan 28 2015 17:20:08ã >ã > DM> It appears you're running Synchronet v3.15b, which uses an olderã > DM> version of the Mozilla-JavaScript engine (SpiderMonkey). Upgrade toã > DM> v3.16a (The currently development build) and you'll get a much newerã > DM> JavaScript engine as well.ã >ã > Ah, yes, I was going to ask about this. Now that I'm delving into fileã > IO; the File object is the one that was proposed for SpiderMonkey that I'veã > googled, no?ããPossibly. Originally, the Synchronet File class was based on the jsshellãimplementation that came with SpiderMonkey, but has been enhanced greatly since ãthen.ãã digital manããSynchronet "Real Fact" #58:ãSynchronet apparel and merchandise can be purchased at cafepress.com/synchronetãNorco, CA WX: 70.3øF, 36.0% humidity, 5 mph WNW wind, 0.00 inches rain/24hrsã---ã þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.netã
  • From LaRRy LaGoMoRpH@VERT/GRUDGEDU to Sampsa on Wed Feb 4 22:28:36 2015
    Re: String functions?ã By: Sampsa to All on Wed Jan 28 2015 03:03 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?ã > ã > ããIt's easy enough to make this function using a regex, in fact if you searchãgoogle for "javascript trim" it will come up on the w3schools page at theãbottom for where it is unsupported I'm just gonna type it in but you can find aãtidbit more info there.ããfunction trimString(str){ã return str.replace(/^\s+|\s+$/gm,'');ã}ããI could have possibly typed that wrong. Giving you the answer cause you ownedãup to your boner in the other forum(s?). If that doesn't work check the page,ãcause it should but I may have typed the regex wrong.ããll morph G futureland.grudgemirror.com LaRRy LaGoMoRpH\-/ã Oã =M=ã'not your average board check it out' /-\ããã---ã þ Synchronet þ Futureland.Grudgemirror.Com ** LIVE ** Music andã
  • From Sampsa@VERT/B4BBS to LaRRy LaGoMoRpH on Thu Feb 5 17:31:00 2015
    LaRRy LaGoMoRpH wrote to Sampsa <=-ãã LL> I could have possibly typed that wrong. Giving you the answer causeã LL> you owned up to your boner in the other forum(s?). If that doesn'tã LL> work check the page, cause it should but I may have typed the regexã LL> wrong.ããThe upgrade did the trick - but thanks anyway.ãã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)ã
  • From Tracker1@VERT to Sampsa on Sun Feb 8 16:24:49 2015
    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 þ [vert/cvs/bbs].synchro.netã
  • From Tracker1@VERT to Khelair on Sun Feb 8 16:27:35 2015
    Ah, yes, I was going to ask about this. Now that I'm delving into fileã > IO; the File object is the one that was proposed for SpiderMonkey that I'veã > googled, no?ããSynchronet's File IO uses it's own interface, it doesn't really follow theãproposed file interface, or commonjs, or node's... If you really want to doãfile manipulation from JS, you may be better off doing those parts withãnode.js or io.js ... There are some much richer libraries out there for this,ãbut they won't necessarily run under Synchronet.ã--ãMichael J. Ryanãhttp://tracker1.info/ã---ã þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.netã
  • From Deuce@VERT/SYNCNIX to Tracker1 on Sun Feb 8 17:20:33 2015
    Re: Re: JavaScript functionalityã By: Tracker1 to Khelair on Sun Feb 08 2015 04:27 pmãã > Synchronet's File IO uses it's own interface, it doesn't really follow theã > proposed file interface, or commonjs, or node's... If you really want toã > do file manipulation from JS, you may be better off doing those parts withã > node.js or io.js ... There are some much richer libraries out there forã > this, but they won't necessarily run under Synchronet.ããThe Synchronet file IO interface is actually more flexable and powerful than
    any of the ones you mentioned (they don't do file range locking or share modes for example) and tend to be POSIX-centric for the additional features they support.ããIf you want serious cross-platform file manipulation, it's hard to beat
    Synchronet's object model. Of course, you're tying youself to Synchonet then, but I absolutely wouldn't say you'll be "better off" doing those parts in a different JS engine.ãã---ãhttp://DuckDuckGo.com/ a better search engine that respects your privacy.ã þ Synchronet þ My Brand-New BBS (All the cool SysOps run STOCK!)ã
  • From Sampsa@VERT/B4BBS to Tracker1 on Mon Feb 9 15:27:00 2015
    Tracker1 wrote to Sampsa <=-ãã Tr> @VIA: VERTã Tr> @MSGID: <54D7FE51.1802.sync-js@vert.synchro.net>ã Tr> @REPLY: <54C8FA4E.1725.sync_js@b4bbs.com>ã 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)ã