c# - Checking String contains only number -
c# - Checking String contains only number -
this question has reply here:
regex numbers only 14 answers how identify if string number? 18 answershow check string number or not. verifying mobile number codes in should have 10 digits , in numerical format.
string str="9848768447" if(str.length==10 && here need status check string number or not) { //code goes here } i new programming. please help me
use int.tryparse:
int i; if(str.length==10 && int.tryparse(str, out i)) { //code goes here } another way has issues unicode digits using char.isdigit:
if(str.length==10 && str.all(char.isdigit)) { } c#
Comments
Post a Comment