Function locateHuisnummer(str As String) As Long
Dim i As Integer
Dim start As Integer
start = 1
If Len(str) > 5 Then start = Len(str) - 5
For i = start To Len(str)
If IsNumeric(Mid(str, i, 1)) Then
locateHuisnummer = i - 1
Exit For
End If
Next
End Function
Function straatnaam(str As String) As String
Dim strEnd As Integer
strEnd = locateHuisnummer(str)
If strEnd > 0 Then straatnaam = Trim(UCase(Left(str, strEnd))) Else straatnaam = Trim(UCase(str))
End Function
Function huisnummertoevoeging(str As String) As String
Dim strStart As Integer
strStart = locateHuisnummer(str)
If strStart > 0 Then huisnummertoevoeging = Right(str, Len(str) - strStart) Else huisnummertoevoeging = ""
End Function
Function locateToevoeging(str As String) As Long
Dim i As Integer
For i = 1 To Len(str)
If Not IsNumeric(Mid(str, i, 1)) Then
locateToevoeging = i - 1
Exit For
End If
Next
End Function
Function huisnummer(str As String) As String
Dim ht As String
ht = huisnummertoevoeging(str)
Dim strEnd As Integer
strEnd = locateToevoeging(ht)
If strEnd > 0 Then huisnummer = Trim(Left(ht, strEnd)) Else huisnummer = Trim(ht)
End Function
Function toevoeging(str As String) As String
Dim ht As String
ht = huisnummertoevoeging(str)
Dim strStart As Integer
strStart = locateToevoeging(ht)
If strStart > 0 Then toevoeging = Trim(Right(ht, Len(ht) - strStart)) Else toevoeging = ""
End Function
Function cleanPC(str As String) As String
Dim i As Integer
cleanPC = UCase(str)
cleanPC = Replace(cleanPC, " ", "")
cleanPC = Replace(cleanPC, "-", "")
End Function