Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Public Function basOnlyNum(strIn As String) As String
'to return only the Numeric Part (Characters) from the input
'Example Usage:
'? basOnlyNum("1lkj34l;kj2435")
'1342435
'Print basOnlyNum("1lkj34l.kj2435")
'1342435
'Print basOnlyNum("1lkj34l.kj2.435")
'1342.435
Dim Idx As Integer
Dim strChr As String * 1
Dim strPrevChr As String * 1
Dim strTemp As String
For Idx = 1 To Len(strIn)
strChr = Mid(strIn, Idx, 1) 'Just to Get a chr
If (IsNumeric(strChr)) Then 'If it is a NUMBER, add to the output
strTemp = strTemp & strChr
End If
'Here for what ever other "Stuff" might be in a number,
'LIKE a decimal point?
'If it is the FIRST Chr AND the NEXT Chr is Numer
If ((strChr = ".") And _
(Idx = 1) And _
IsNumeric((Mid(strIn, Idx + 1, 1)))) Then
strTemp = strTemp & strChr
End If
'LIKE a decimal point?
'If it is preceeded by a NUM
If (strChr = "." And IsNumeric(strPrevChr)) Then
strTemp = strTemp & strChr
End If
strPrevChr = strChr
Next Idx
basOnlyNum = strTemp
End Function