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