Skip to main content

๐Ÿ‘ฉโ€๐Ÿ’ป ๅˆคๆ–ทๅญ—ไธฒๆ˜ฏๅฆ็‚บๆ•ธๅญ—

StringName.All(char.IsDigit);
using System;
using System.Linq;

public class IdentifyString
{
public static void Main()
{
string number = "123456";
if(number.All(char.IsDigit))
{
Console.WriteLine("The Given String is a Number.");
}
else
{
Console.WriteLine("The Given String is Not a Number.");
}
}
}

ref: C# ่ญ˜ๅˆฅๅญ—ไธฒๆ˜ฏๅฆ็‚บๆ•ธๅญ— | Dๆฃง - Delft Stack