C#-এ Char.IsNumber() মেথডটি নির্দিষ্ট ইউনিকোড ক্যারেক্টারটি সংখ্যা ক্যাটাগরির অন্তর্ভুক্ত কিনা তা যাচাই করে।
সিনট্যাক্স
public static bool IsNumber (char ch);
উদাহরণ ১
ক্যারেক্টার '২' সংখ্যা কিনা যাচাই করা হয়েছে।
using System;
public class Demo {
public static void Main(){
bool res;
char val = '2';
Console.WriteLine("Value = " + val);
res = Char.IsNumber(val);
Console.WriteLine("Is the value a number? = " + res);
}
}
আউটপুট
Value = 2 Is the value a number? = True
উদাহরণ ২
ক্যারেক্টার 'P' সংখ্যা নয়।
using System;
public class Demo {
public static void Main(){
bool res;
char val = 'P';
Console.WriteLine("Value = " + val);
res = Char.IsNumber(val);
Console.WriteLine("Is the value a number? = " + res);
}
}
আউটপুট
Value = P Is the value a number? = False