Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

To check whether the string value has numeric value or not in C#

Tags:

asp.net

c#-2.0

I am having an string like this

string str = "dfdsfdsf8fdfdfd9dfdfd4"

I need to check whether the string contains number by looping through the array.

like image 524
balaweblog Avatar asked Nov 06 '08 09:11

balaweblog


1 Answers

What about a regular expression:

bool val = System.Text.RegularExpressions.Regex.IsMatch(str, @"\d");
like image 186
kgiannakakis Avatar answered Oct 13 '22 22:10

kgiannakakis