char c;
for (int i = 0; i < str.Length; i++)
{
c = str.Substring(i,1)[0];
if (((c <='F') && (c >='A')) == false && ((c <='f') && (c >='a')) == false && ((c<='9') && (c >='0')) == false)
{
MessageBox.Show("Error, SN should be in scale of [A-Fa-f0-9]!", "Warning");
return false;
}
}
return true;
C# winform 中---string是否在0-9A-Fa~f之间的判断
于 2022-02-23 15:08:33 首次发布