Your welcome Ariel, in any case in your blog put a ++ before start because
that -- does not sound that good :D

// Licensed under BSD
function myBestTrim( str ){
 var start = -1,
  end = str.length;
 while( str.charCodeAt(--end) < 33 );
 while( str.charCodeAt(--start) < 33 ); // ++start is better, isn't it? :-)
 return str.slice( start, end + 1 );
};


Kind Regards

On Thu, Nov 6, 2008 at 1:35 PM, Ariel Flesler <[EMAIL PROTECTED]> wrote:

>
> As expected, took a little less w/o that check, but x2 when all spaces.
> I think that's not a situation to worry about.
>
> Thanks Andrea for noticing.
>
> On Wed, Nov 5, 2008 at 11:21 AM, Ariel Flesler <[EMAIL PROTECTED]> wrote:
> > Ok, I'll benchmark #1 (hopefully today). I'll then create a ticket and
> > commit the fastest/shortest trim.
> >
> > On Wed, Nov 5, 2008 at 10:13 AM, John Resig <[EMAIL PROTECTED]> wrote:
> >>
> >>> There is probably one case where it does not perform faster, length 1
> or 0,
> >>> but we are talking abut 1 to 5 miliseconds in both cases, and about "0"
> with
> >>> new browsers possibilities.
> >>
> >> I don't think this should really be optimized - everything is going to
> >> be fast for incredibly small values like this.
> >>
> >> --John
> >>
> >> >>
> >>
> >
> >
> >
> > --
> > Ariel Flesler
> > http://flesler.blogspot.com
> >
>
>
>
> --
> Ariel Flesler
> http://flesler.blogspot.com
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" 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/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to