/ Published in: ASP
Expand |
Embed | Plain Text
'Option1 If x = CInt(x) Then '... 'Option2 If TypeName(x) = "Integer" Then '... 'Option3 'Relies on LCID=1033 eg. point (".") is a decimal delimiter instead of comma (",")) If InStr(x,".") = 0 'OR If CBool(InStr(x,".")) 'Option4 Function isInteger (number) Dim result if(IsNumeric(number)) then if(InStr(number,".")=0) then result=true else result=False end if else result=False end if isInteger = result End Function 'Option5 Function IsInteger(byVal string) dim regExp, match, i, spec For i = 1 to Len( string ) spec = Mid(string, i, 1) Set regExp = New RegExp regExp.Global = True regExp.IgnoreCase = True regExp.Pattern = "[0-9]" set match = regExp.Execute(spec) If match.count = 0 then IsInteger = False Exit Function End If Set regExp = Nothing Next IsInteger = True End Function
Comments
Subscribe to comments
You need to login to post a comment.

This looks more like VB.NET