JavaScript 实现 PHP (trim)
// Trim() , Ltrim() , RTrim()
String.prototype.Trim = function()
{
return this.replace(/(^\s*)|(\s*$)/g, “”);
}
String.prototype.LTrim = function()
{
return this.replace(/(^\s*)/g, “”);
}
String.prototype.RTrim = function()
{
return this.replace(/(\s*$)/g, “”);
}
Tags: itrim, PHP
This entry was posted
on 星期天, 六月 7th, 2009 at 3:12 上午 and is filed under
jquery.
You can follow any responses to this entry through the
RSS 2.0 feed.
You can
leave a response, or
trackback from your own site.
Comments