旷世孤独墨尔本

.Net编程,关注程序,关注生活.

 

2007年7月3日

vs2005网站发布大全

要点:

posted @ 2007-07-03 15:10 墨尔 阅读(148) 评论(0) 编辑

javascript 扩充String类型的函数功能

 


String.prototype.trim  = function(){ return this.replace(/(^[\s]*)|([\s]*$)/g, "");

String.prototype.ltrim = function(){ return this.replace(/(^[\\s]*)/g, ""); }
String.prototype.rtime = function(){ return this.replace(/([\\s]*$)/g, ""); }

String.prototype.realLength = function(){ return this.replace(/[^\\x00-\\xff]/g,"**").length; }//计算字符串的长度,一个汉字两个字符
//功能:检测是否为空或NULL值

String.prototype.isNullOrEmpty = function() { return this.trim().realLength() < 1 ? true : false; }
String.prototype.toLower = function() { return this.toLowerCase(); }
String.prototype.toUpper = function() { return this.toUpperCase(); }

posted @ 2007-07-03 14:29 墨尔 阅读(118) 评论(0) 编辑

导航

统计

公告