trim:去除两边空格 lTrim:去除左空格 rTrim: 去除右空格
<script language='javascript'>
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, "");
}
//使用时只需要调用一下就可以了。
function DropSpace(obj)
{
var v=obj.value.trim();
}
</script>
0
0
javascript练习:810事件与this运算符
SQL: case when的用法(转)
C++ :stringstream介绍,使用方法与例子(转)
【玩转.Net MF – 01】Flash远程读写
【.Net Micro Framework PortingKit – 13】LCD驱动开发
【玩转.Net MF – 03】远程文件查看器
【玩转.Net MF – 02】让PC成为MF的鼠标键盘
【.Net Micro Framework PortingKit – 12】SysTick驱动开发
【.Net Micro Framework PortingKit – 11】NandFlash驱动开发