Door Games Unlimited

Welcome, Guest.


Subject: console.putmsg alternative that returns a string Date: Thu Oct 02 2014 07:29:35
From: Nightfox To: Psi-Jack

  Re: console.putmsg alternative that returns a string
  By: Psi-Jack to Nightfox on Thu Oct 02 2014 08:23:32

 Ps>>> text = text.replace(/@([^@]+)@/g, function(m, code) {
 Ps>>> return bbs.atcode(code);
 Ps>>> });

 Ps> Hmm, yeah. I don't think there's anything else. This text.replace itself
 Ps> goes through each beginning and ending @ code block and translates each
 Ps> one, at least as far as I can tell it does. the variable, text, becomes
 Ps> the full at-code translated result. 

Yep, I've used JavaScript's string replace() function in some of my scripts. 
And regular expressions are awesome.

Nightfox

---
 ■ Synchronet ■ Digital Distortion BBS - digitaldistortionbbs.com

Previous Message       Next Message
In Reply To: console.putmsg alternative that returns a string (Psi-Jack)