<SCRIPT LANGUAGE="JavaScript">
<!--
function num(str)
{
return str.replace(/[^\x00-\xff]/g,"**").length-str.length;
}
alert(num("你好"));
//-->
</SCRIPT>
<!--
function num(str)
{
return str.replace(/[^\x00-\xff]/g,"**").length-str.length;
}
alert(num("你好"));
//-->
</SCRIPT>
Imports System.Web.Mail
Imports System.Data.SqlClient
Imports Microsoft.VisualBasic
Imports System.Web.HttpContext
Imports System.Text.RegularExpressions
Module _function
'下面函数可以返回字符串的长度,汉字为两个字节,英文字母为一个字节
Public Function WordLength(ByVal str As String) As Integer
Return Encoding.Default.GetByteCount(str)
End Function