首页 > 应用开发 > IT综合 > 用C#檢查字符串中是否有Unicode字符
///
/// 檢查strInput中是否有Unicode字符
///
/// 要檢查的字符串
///
public static bool CheckExistUnicode(string strInput)
{
int i = strInput.Length;
if (i == 0)
return false;
int j = System.Text.Encoding.Default.GetBytes(strInput).Length;
if (i != j)
return true;
else
return false;
}
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/9437124/viewspace-1001737/ ,如需转载,请注明出处,否则将追究法律责任。