得到中英混合字符串长度一法
protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args){
string s = args.Value;
byte[] sarr = System.Text.Encoding.Default.GetBytes(s);
int len = sarr.Length;//will output as 3+2*2=7
if (len < 4 || len > 20)
args.IsValid = false;
}
string s = args.Value;
byte[] sarr = System.Text.Encoding.Default.GetBytes(s);
int len = sarr.Length;//will output as 3+2*2=7
if (len < 4 || len > 20)
args.IsValid = false;
}