• mode parameter in console.strlen()

    From Nightfox@VERT/DIGDIST to Digital Man on Thursday, June 23, 2022 09:21:55
    Hi DM,

    I'm curious what the mode parameter is for in console.strlen()? jsobjs.html says mode is an optional parameter, but it doesn't say what it's for. When looking at the mode values in sbbsdefs.js, it seems some don't make sense for getting string length (such as P_NOABORT, P_NOABORT, etc.)..
    Also, P_NOATCODES might make sense, but I'd think console.strlen() already would not be counting at-codes as part of string length..?

    Nightfox

    ---
    þ Synchronet þ Digital Distortion: digitaldistortionbbs.com
  • From Digital Man@VERT to Nightfox on Thursday, June 23, 2022 10:44:11
    Re: mode parameter in console.strlen()
    By: Nightfox to Digital Man on Thu Jun 23 2022 09:21 am

    Hi DM,

    I'm curious what the mode parameter is for in console.strlen()?

    Today, it's only use is to control whether the passed string is expected to be UTF-8 encoded or not.

    jsobjs.html
    says mode is an optional parameter, but it doesn't say what it's for. When looking at the mode values in sbbsdefs.js, it seems some don't make sense for getting string length (such as P_NOABORT, P_NOABORT, etc.)..
    Also, P_NOATCODES might make sense, but I'd think console.strlen() already would not be counting at-codes as part of string length..?

    It *does* count at-codes as part of the string. Passing P_NOATCODES would have no effect.

    The only checked/used P_* (print) mode flag in console.strlen() is P_UTF8.
    --
    digital man (rob)

    Synchronet "Real Fact" #89:
    Rob played drums on the LP "Weedpuller" available for digital purchase/stream Norco, CA WX: 86.3øF, 39.0% humidity, 1 mph E wind, 0.00 inches rain/24hrs
    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Nightfox@VERT/DIGDIST to Digital Man on Thursday, June 23, 2022 11:43:14
    Re: mode parameter in console.strlen()
    By: Digital Man to Nightfox on Thu Jun 23 2022 10:44 am

    etc.).. Also, P_NOATCODES might make sense, but I'd think
    console.strlen() already would not be counting at-codes as part of
    string length..?

    It *does* count at-codes as part of the string. Passing P_NOATCODES would have no effect.

    I was thinking attribute codes when I wrote that.. :P It makes sense that it would count at-codes as part of the string.

    The only checked/used P_* (print) mode flag in console.strlen() is P_UTF8.

    I see. Thanks.

    Nightfox

    ---
    þ Synchronet þ Digital Distortion: digitaldistortionbbs.com