class Program
{
static bool Is_integer(string str)
{
int n;
for (n = 0; n < str.Length; n++)
{
string character = str.Substring(n, 1);
Console.WriteLine(character);
System.Text.ASCIIEncoding asciiEncoding = new System.Text.ASCIIEncoding();
int intAsciiCode = (int)asciiEncoding.GetBytes(character)[0];
Console.WriteLine(intAsciiCode);
if (intAsciiCode < 48 || intAsciiCode > 57)
{
return false;
break;
}
}
return true;
}
static void Main(string[] args)
{
string str = "1234g";
Console.WriteLine(Is_integer(str).ToString());
Console.ReadKey();
}
}
{
static bool Is_integer(string str)
{
int n;
for (n = 0; n < str.Length; n++)
{
string character = str.Substring(n, 1);
Console.WriteLine(character);
System.Text.ASCIIEncoding asciiEncoding = new System.Text.ASCIIEncoding();
int intAsciiCode = (int)asciiEncoding.GetBytes(character)[0];
Console.WriteLine(intAsciiCode);
if (intAsciiCode < 48 || intAsciiCode > 57)
{
return false;
break;
}
}
return true;
}
static void Main(string[] args)
{
string str = "1234g";
Console.WriteLine(Is_integer(str).ToString());
Console.ReadKey();
}
}