Home >Web Front-end >JS Tutorial >取得一定长度的内容,处理中文_javascript技巧

取得一定长度的内容,处理中文_javascript技巧

WBOY
WBOYOriginal
2016-05-16 19:23:20893browse
复制代码 代码如下:

//字符 长度
function xLength(m,n)
{
if(m==null || m=="")return ""
var s=m.replace(/([^\x00-\xff])/g,"\x00$1");
return (s.length}
http://3http.com/
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn