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
-~----------~----~----~----~------~----~------~--~---

Reply via email to