Introduction
This is simple function (written in VB.Net) which tells whether the given string is in digits or not.
Description
To check this I will simply make two functions:
1- Page_Load(Sender As Object, E As EventArgs)
2- Check_For_Numeric_Format(C_S)
We will declare one variable in Page_Load e.g., "Var_String", assign it the value and then call the function "Check_For_Numeric_Format(Var_String)". The code is given below:
Source Code
Sub Page_Load(Sender As Object, E As EventArgs)<BR> If Not Page.IsPostBack Then<BR> Dim Var_String<BR> Var_String = "1234567890"<BR> If Check_For_Numeric_Format(Var_String) = True Then<BR> Response.Write("Congratulations! The string is in digits.")<BR> Else<BR> Response.Write("Sorry! The string is not in digits.")<BR> End If<BR> End If<BR>End Sub<BR><BR>Function Check_For_Numeric_Format(C_S)<BR> Dim Var_Loop, Var_Len<BR> If C_S = "" Then<BR> Return False<BR> End If<BR> Var_Len = Len(C_S)<BR> C_S = LCase(C_S)<BR> For Var_Loop = 1 To Var_Len<BR> If Mid(C_S, Var_Loop, 1) < Chr(48) Or Mid(C_S, Var_Loop, 1) > Chr(57) Then<BR> Return False<BR> End If<BR> Next<BR> Return True<BR>End Function
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here