Domino Code Fragment

Code Name*
Validate Social Security
Date*
04/29/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.3.149.233.72
Description*
Try the following code to validate your social security number.
Type*
LotusScript
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:

Public Function ChkForDigits(inputstring As String,ReqNoOfDigit As Integer) As Integer
' Input Parameters:
' inputstring - string to be checked
' ReqNoOfDigit - if value is 0, do not verify.
' - if value > 0, verify the number of digits passed from inputstring


'This function takes the string and returns the following value code:
' returns 0. if all digits (do not care number of digits, only if ReqNoOfDigit = 0
' 1. if all digits and number of digits is equal to ReqNoOfDigits
' 2. if all digits but the number of digits is NOT equal to parameter ReqNoOfDigits
' 3. Not all digits or null character


Dim index As Integer
Dim counter As Integer
Dim AlphaFound As Integer


AlphaFound=False
index%=Len(inputstring$)
If index%=0 Then ' check if null string
ChkForDigits=3
Else
For counter%=1 To index%
If Mid$(inputstring$, counter%, 1) Like "[0-9]" Then
' do nothing
Else
AlphaFound = True ' well, it contains some characters
Exit For
End If
Next
If AlphaFound Then
ChkForDigits=3
Else
Select Case ReqNoOfdigit
Case Index%: ChkForDigits = 1
Case 0 : ChkForDigits=0
Case Else: ChkForDigits=2
End Select


End If
End If
End Function