• Synchronet JSOM - truncsp

    From art@DIGDIST/BATTLEST/FREEWAY to All on Tue Nov 17 09:47:00 2009
    Hey guys,

    Thought I'd try my luck posting to DevNet rather than Dove...

    There is a Synchronet JSOM method .truncsp() to truncate the space at the end of string... is there the opposite, i.e., something that can trim the whitespaces at the beginning of a string?

    Regards,
    Art at fatcats dot poorcoding dot com

    | fatcats bbs |
    | + telnet://fatcats.poorcoding.com |
    | + ssh://fatcats.poorcoding.com:2322 |

    ---
    þ Synchronet þ fatcats bbs - http://fatcats.poorcoding.com
  • From Nightfox@DIGDIST/BATTLEST/FREEWAY to art on Mon Nov 23 00:53:00 2009
    Re: Synchronet JSOM - truncsp() opposite?
    By: art to All on Tue Nov 17 2009 09:47:14

    There is a Synchronet JSOM method .truncsp() to truncate the space at the of string... is there the opposite, i.e., something that can trim the whitespaces at the beginning of a string?

    This is not the right sub-board for that language; this sub-board is for Java, not JavaScript. As this is a JavaScript question, the best sub-board for this question would be "Web Tech: HTML/CSS/JavaScript/frameworks". There currently isn't a sub-board on DeveloperNet specifically for Synchronet JavaScript, so that might be the best place for now.

    Anyway, there is a function I know of that could let you do that - it's part of the standard JavaScript string object rather than part of Synchronet's JavaScript library. The string's replace() method, when used with a regular expression, could do it. For example, if you have a string variable someStr: someStr = someStr.replace(/^ +/, "");

    That replaces 1 or more spaces at the beginning of the string with an empty string and returns a copy (in this case, we want to store the new string back in the original variable).

    Nightfox

    ---
    þ Synchronet þ Digital Distortion: digitaldistortionbbs.com
  • From art@DIGDIST/BATTLEST/FREEWAY to Nightfox on Wed Nov 25 09:11:00 2009
    Re: Synchronet JSOM - truncsp() opposite?
    By: Nightfox to art on Mon Nov 23 2009 00:53:43

    This is not the right sub-board for that language; this sub-board is for Jav not JavaScript. As this is a JavaScript question, the best sub-board for th question would be "Web Tech: HTML/CSS/JavaScript/frameworks". There current isn't a sub-board on DeveloperNet specifically for Synchronet JavaScript, so that might be the best place for now.

    Nightfox,

    Apologies for posting to the wrong sub.

    Kind regards,
    +---------------------------------------+
    | Art at fatcats dot poorcoding dot com |
    +---------------------------------------+
    | fatcats bbs |
    | + telnet://fatcats.poorcoding.com |
    | + ssh://fatcats.poorcoding.com:2322 |
    | + http://fatcats.poorcoding.com |
    +---------------------------------------+
    | Post a note on my fridge: |
    | http://app.poorcoding.com/fridge |
    +---------------------------------------+

    ---
    þ Synchronet þ fatcats bbs - http://fatcats.poorcoding.com