Subj : Re: truncsp() for beginnings of strings?
To : art
From : Tracker1
Date : Tue Nov 17 2009 10:19 pm
On 11/17/2009 2:48 AM, art wrote:
> Hi all,
>
> Is there a way to trim whitespaces at the beginning of strings, like truncsp()?
//include this somewhere...
String.prototype.trim = function() {
return this.replace(/^[\s\r\n]+|[\s\r\n]+$/g, '');
}
String.prototype.ltrin = function() {
return this.replace(/^[\s\r\n]+/g, '');
}
String.prototype.ltrin = function() {
return this.replace(/[\s\r\n]+$/g, '');
}
now you can use yourstring.ltrim()
--
Michael J. Ryan -
http://tracker1.info/
... B5: Then what kind of head of security would I be if I let people like me
know things that I'm not supposed to know? I know what I know because I have
to know it. And if I don't have to know it, I don't tell me, and I don't let
anyone else tell me either.
---
� Synchronet � Roughneck BBS - telnet://roughneckbbs.com - www.roughneckbbs.com