G Guest Dec 18, 2003 #1 is there any function to know if a character is a Digit Thanks in advantage...
M Marco Martin Dec 18, 2003 #3 try this, it might not be the best solution but it works; public bool IsInteger(Char theValue) { try { Convert.ToInt32(theValue); return true; } catch { return false; } } //IsInteger
try this, it might not be the best solution but it works; public bool IsInteger(Char theValue) { try { Convert.ToInt32(theValue); return true; } catch { return false; } } //IsInteger
J Jon Skeet [C# MVP] Dec 18, 2003 #4 Marco Martin said: try this, it might not be the best solution but it works; public bool IsInteger(Char theValue) { try { Convert.ToInt32(theValue); return true; } catch { return false; } } //IsInteger Click to expand... No it doesn't - Convert.ToInt32(char) doesn't do what you think it does. For instance, try this: using System; public class Test { static void Main() { Console.WriteLine (Convert.ToInt32('A')); } }
Marco Martin said: try this, it might not be the best solution but it works; public bool IsInteger(Char theValue) { try { Convert.ToInt32(theValue); return true; } catch { return false; } } //IsInteger Click to expand... No it doesn't - Convert.ToInt32(char) doesn't do what you think it does. For instance, try this: using System; public class Test { static void Main() { Console.WriteLine (Convert.ToInt32('A')); } }
M Marco Martin Dec 18, 2003 #5 S***T! You're right. Sorry about that. Marco Jon Skeet said: No it doesn't - Convert.ToInt32(char) doesn't do what you think it does. For instance, try this: using System; public class Test { static void Main() { Console.WriteLine (Convert.ToInt32('A')); } } Click to expand...
S***T! You're right. Sorry about that. Marco Jon Skeet said: No it doesn't - Convert.ToInt32(char) doesn't do what you think it does. For instance, try this: using System; public class Test { static void Main() { Console.WriteLine (Convert.ToInt32('A')); } } Click to expand...