javascript正則表達式取漢字的長度,一個漢字佔兩個字節長度

<html> <body> <script language="javascript"> String.prototype.len=function(){return this.replace(/[^/x00-/xff]/g,"aa").length;}javascript function test() {  alert("中國aa".len()) ;  html } </script> <in
相關文章
相關標籤/搜索