using System.Text.RegularExpressions; .... if (Regex.IsMatch(str,"\d+")) ... if (Regex.IsMatch(str,"\w+")) ... if (Regex.IsMatch(str,"[\u4e00-\u9fa5]+"))
方法很多啊,把form的最大和最小的大小调的一样大,就再怎么着也改变不了大小了
UnicodeEncoding unicodeEncoding = new UnicodeEncoding(); byte [] unicodeByteArray = unicodeEncoding.GetBytes( inputString ); for( int i = 0; i < unicodeByteArray.Length; i++ ) { i++; //如果是中文字符那么高位不为0 if ( unicodeByteArray[i] != 0 ) { } ……
判断汉字: Regex r= new Regex(@"[\u4e00-\u9fa5]+"); MatchCollection m=r.Match(yourstring);
....
if (Regex.IsMatch(str,"\d+"))
...
if (Regex.IsMatch(str,"\w+"))
...
if (Regex.IsMatch(str,"[\u4e00-\u9fa5]+"))
byte [] unicodeByteArray = unicodeEncoding.GetBytes( inputString );
for( int i = 0; i < unicodeByteArray.Length; i++ )
{
i++;
//如果是中文字符那么高位不为0
if ( unicodeByteArray[i] != 0 )
{
}
……
Regex r= new Regex(@"[\u4e00-\u9fa5]+");
MatchCollection m=r.Match(yourstring);
看看这个!