• console.strlen(text) vs. strip_ctrl(text).length

    From Nightfox@VERT/DIGDIST to Digital Man on Sun Jan 4 09:39:02 2015
    Hi DM,ããWhile working on one of my scripts, there are some places where I need to getãthe length of a string as it will appear on the screen. It seems there are twoãways to do so - console.strlen(text) and strip_ctrl(text).length. Whileãworking on one of my JS scripts, I noticed I'm getting two different resultsãfrom each of those ways of getting string length for one of my script'sãstrings. Specifically, my string has a 4 special characters to representãarrows, which are counted by console.strlen(), but those special arrowãcharacters seem to be removed by strip_ctrl(). The following image shows theãtext line output from my script with the 4 arrow characters (it's a help lineãshowing some valid key commands):ãhttp://home.comcast.net/~nightfox/BBSStuff/helpLine.pngããThe length returned by console.strlen() is 79, whereas the length returned byãstrip_ctrl(text).length is 75.ããThe documentation says console.strlen() will exclude Ctrl-A codes, whileãstrip_ctrl() removes control characters. It sounds like strip_ctrl() might beãremoving all control characters (not just Ctrl-A characters), is that correct?ãI was curious if what I'm seeing is the expected behavior.ããNightfoxãã---ã þ Synchronet þ Digital Distortion BBS - digitaldistortionbbs.comã
  • From Digital Man@VERT to Nightfox on Sun Jan 4 19:20:06 2015
    Re: console.strlen(text) vs. strip_ctrl(text).lengthã By: Nightfox to Digital Man on Sun Jan 04 2015 09:39 amãã > Hi DM,ã >ã > While working on one of my scripts, there are some places where I need toã > get the length of a string as it will appear on the screen. It seems thereã > are two ways to do so - console.strlen(text) and strip_ctrl(text).length.ã > While working on one of my JS scripts, I noticed I'm getting two differentã > results from each of those ways of getting string length for one of myã > script's strings. Specifically, my string has a 4 special characters toã > represent arrows, which are counted by console.strlen(), but those specialã > arrow characters seem to be removed by strip_ctrl(). The following imageã > shows the text line output from my script with the 4 arrow characters (it'sã > a help line showing some valid key commands):ã > http://home.comcast.net/~nightfox/BBSStuff/helpLine.pngã >ã > The length returned by console.strlen() is 79, whereas the length returnedã > by strip_ctrl(text).length is 75.ã >ã > The documentation says console.strlen() will exclude Ctrl-A codes, whileã > strip_ctrl() removes control characters. It sounds like strip_ctrl() mightã > be removing all control characters (not just Ctrl-A characters), is thatã > correct? I was curious if what I'm seeing is the expected behavior.ããYes, strip_ctrl() removes all control characters (ASCII value less than 32) andãall Ctrl-A code sequences.ããWhat's the ASCII value of these "4 special characters to represent arrows"?ãã digital manããSynchronet "Real Fact" #71:ãSynchronet CIOXTRN (created by Deuce) is a 32-bit replacement for DOORWAY.ãNorco, CA WX: 59.1øF, 32.0% humidity, 7 mph W wind, 0.00 inches rain/24hrsã---ã þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.netã
  • From Nightfox@VERT/DIGDIST to Digital Man on Sun Jan 4 19:54:25 2015
    Re: console.strlen(text) vs. strip_ctrl(text).lengthã By: Digital Man to Nightfox on Sun Jan 04 2015 19:20:06ãã DM> Yes, strip_ctrl() removes all control characters (ASCII value less thanã DM> 32) and all Ctrl-A code sequences.ãã DM> What's the ASCII value of these "4 special characters to representã DM> arrows"? ããMakes sense. The ASCII values (in decimal) are 16, 17, 24, and 25.ããNightfoxãã---ã þ Synchronet þ Digital Distortion BBS - digitaldistortionbbs.comã
  • From Digital Man@VERT to Nightfox on Mon Jan 5 17:01:28 2015
    Re: console.strlen(text) vs. strip_ctrl(text).lengthã By: Nightfox to Digital Man on Sun Jan 04 2015 07:54 pmãã > Re: console.strlen(text) vs. strip_ctrl(text).lengthã > By: Digital Man to Nightfox on Sun Jan 04 2015 19:20:06ã >ã > DM> Yes, strip_ctrl() removes all control characters (ASCII value lessã > DM> than 32) and all Ctrl-A code sequences.ã >ã > DM> What's the ASCII value of these "4 special characters to representã > DM> arrows"?ã >ã > Makes sense. The ASCII values (in decimal) are 16, 17, 24, and 25.ããYup, those are control character. You can't really rely on them being displayed ãas printable characters (aka 'glyphs') in the terminal. If you try different ãterminal programs, you'll likely see different/inconsistent results.ãã digital manããSynchronet "Real Fact" #69:ãRob Swindell was interviewed for Jason Scott's BBS Documentary in July of 2002.ãNorco, CA WX: 71.8øF, 18.0% humidity, 7 mph W wind, 0.00 inches rain/24hrsã---ã þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.netã
  • From Nightfox@VERT/DIGDIST to Digital Man on Mon Jan 5 19:55:16 2015
    Re: console.strlen(text) vs. strip_ctrl(text).lengthã By: Digital Man to Nightfox on Mon Jan 05 2015 17:01:28ãã >> Makes sense. The ASCII values (in decimal) are 16, 17, 24, and 25.ãã DM> Yup, those are control character. You can't really rely on them beingã DM> displayed as printable characters (aka 'glyphs') in the terminal. If youã DM> try different terminal programs, you'll likely see different/inconsistentã DM> results. ããI see. I'll have to give that a try.ããNightfoxãã---ã þ Synchronet þ Digital Distortion BBS - digitaldistortionbbs.comã