P
Per Rollvang
Hi All!
I have a problem with hex strings when using Char.IsDigit().
The hex strings(i.e. a CRC32 checksum) get a false result for letters A-F...
MSDN tell me that:
[Char.IsDigit()] Indicates whether a Unicode character is categorized as a
decimal digit or hexadecimal number.
My method goes like this:
public bool IsNumeric(string sIn)
{
bool bRet = true;
string s = sIn.ToUpper();
char[] tmp = s.ToCharArray();
for (int i = 0; i < tmp.Length;i++)
{
if (!char.IsDigit(sIn,i))
{
bRet = false;
break;
}
}
return bRet;
}
Anyone?
TIA
Per Rollvang
I have a problem with hex strings when using Char.IsDigit().
The hex strings(i.e. a CRC32 checksum) get a false result for letters A-F...
MSDN tell me that:
[Char.IsDigit()] Indicates whether a Unicode character is categorized as a
decimal digit or hexadecimal number.
My method goes like this:
public bool IsNumeric(string sIn)
{
bool bRet = true;
string s = sIn.ToUpper();
char[] tmp = s.ToCharArray();
for (int i = 0; i < tmp.Length;i++)
{
if (!char.IsDigit(sIn,i))
{
bRet = false;
break;
}
}
return bRet;
}
Anyone?
TIA
Per Rollvang