Hi, I have this in VBA. Don't know much about C++, if this can be done with C++, help would be appreciated. thank you...nelson
Code:
Function ValidAddr(addr As String) As Boolean
Dim BadAddrs(2)
Dim pos As Long
Dim i As Integer
pos = 0
i = 0
BadAddrs(0) = "PO BOX"
BadAddrs(1) = "P.O BOX"
BadAddrs(2) = " P.O. BOX"
For i = LBound(BadAddrs) To UBound(BadAddrs)
If (pos = 0) Then
pos = InStr(1, addr, BadAddrs(i))
End If
Next i
If (pos <> 0) Then
ValidAddr = False
Else
ValidAddr = True
End If
End Function
Sub CheckAddr()
Dim isAddrPOBox As Boolean
isAddrPOBox = False
isAddrPOBox = ValidAddr("P.O BOX Rt. 11 P.O there")
MsgBox isAddrPOBox
End Sub