javascript截取字符串,支持中英文(9元包郵)

本博主最近正在建設一個9元包郵的網站,希望各位光臨指導一些意見: 9元包郵 http://www.jiubaou.com/


//截取字符串

String.prototype.cutString = function(length)
{
 var temp = (this.replace(/([\u0391-\uffe5])/ig,'$1a').substring(0,length).replace(/([\u0391-\uffe5])a/ig,'$1'));
 if(this != temp)
 {
  temp = temp +'...';
 }
 return temp;
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章