try to include the trim from php.js <http://phpjs.org/functions/trim:566>then since php has that option as extra argument: http://uk3.php.net/manual/en/function.trim.php
On Fri, Jul 10, 2009 at 9:04 AM, George <george.jqu...@softwareunity.com>wrote: > > Yep, I'm inclined to agree that trim() is for trimming! > > The only little enhancement that I and several colleagues have often > considered is the ability to specify what character to trim off. (The > default being space of course) > > George > > On Jul 9, 8:34 pm, Daniel Friesen <nadir.seen.f...@gmail.com> wrote: > > Ya, I see no reason to extend trim with functionality that has nothing > > to do with trimming. > > If you want to remove all whitespace from a string then just use > > .replace(/\s+/g, ''); yourself, it's not like it's a substantial piece > > of code at all. > > > > If there is any enhancement to .trim it should be using a better method > > of trimming (/^\s+|\s+$/g is slow, seehttp:// > blog.stevenlevithan.com/archives/faster-trim-javascript) and/or > > making use of native trim(); where available (FF3.5). > > > > ~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name] > > > > Darko Romanov wrote: > > > Mmm.. I think space replacing doesn't deal (at all?) with trimming. > > > When I'm programming with a language X and I need to trim I search for > > > a function that does that job, when I need to strip away spaces I > > > usually replace that character with an empty string. > > > > > If we like the smallest size possible for jquery.js then I think this > > > would be the last thing we have to put into. > > > > > d > > > > > On Thu, Jul 9, 2009 at 5:26 PM, dotnetCarpenter< > jon.ronnenb...@gmail.com> wrote: > > > > >> Hi all, > > > > >> I've submitted Ticket #4848 (new enhancement) about a week ago and > > >> would like to hear what you guys think. I think it's handy for > > >> telephone numbers, bank accounts (IBAN/SWIFT) ect. I realize that > > >> changing the core API (no regression) requires some merit. Am I the > > >> only one who like this idea? > > > > >> /** > > >> * Uses a regular expression to remove whitespace from the given > > >> string. > > >> * @param {String} text The string to trim. > > >> * @param {Boolean} [all] True to remove all white-space from the > > >> text. > > >> * @return {String} > > >> */ > > >> trim: function(text, all) { > > >> var reg = all===true ? /\s+/g : /^\s+|\s+$/g; > > >> return (text || "").replace(reg, ''); > > >> } > > > > >> Cheers, Jon. > > > > >> PS. noticed a post back in november 2008 about optimizing the trim > > >> method but don't know what the conclusion was. > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---