Thank you for your support!    
UtterAccess HomeUtterAccess Wiki

Welcome Guest ( Log In | Register )

Edit Discussion
> IsNumbersOnly    

See also: GetDigitsOnly and IsAlphaOnly

CODE
' Code courtesy of UtterAccess Wiki
' http://www.utteraccess.com/wiki/index.php/Category:FunctionLibrary
' Original submission by Walter Niesz
' July 25, 2010
'
' You are free to use it in any application,
' provided the copyright notice is left unchanged.

' DESCRIPTION
' This function tests a given string to see
' whether it is composed of all numeric digits.

Const AllNumbers = "0123456789"

Public Function IsNumbersOnly(StringToTest As String) As Boolean

   Dim i As Long

   IsNumbersOnly = True
   
   For i = 1 To Len(StringToTest)
       If InStr(AllNumbers, Mid(StringToTest, i, 1)) = 0 Then
           IsNumbersOnly = False
           Exit Function
       End If
   Next i
   
End Function


Creative Commons License
IsNumbersOnly by UtterAccess Wiki is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Editing and revision of the content is freely encouraged; for details, see Expected Usage.

Edit Discussion
This page was last modified 09:38, 6 April 2011.  This page has been accessed 1,649 times.  Disclaimers