braudes wrote:
> Hi,
>
> I notice that the String class doesn´t have some simple methods. So, I
> added these:
>
> ltrim: function() {
> var re = /\s*((\S+\s*)*)/;
> return this.replace(re, "$1");
> },
>
> rtrim: function() {
> var re = /((\s*\S+)*)\s*/;
> return this.replace(re, "$1");
> },
>
> trim: function() {
> return this.rtrim().ltrim();
> },
>
> invert: function() {
> var len = this.length;
> var str = "";
> for (var i = len - 1; i > -1 ;i--){
> str += this.charAt(i);
> }
> return str;
> }
Trim is called strip in Prototype.
The others may be simple, but probably not used often enough for a place
in the Core library. And as Richard says, there are a bazillion
variations of these types of functions. Feel free to maintain a plugin
and submit it to scripteka.com.
- Ken Snyder
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---