compile error - syntax error

  • Thread starter Thread starter JohnLute
  • Start date Start date
J

JohnLute

I have a module that's returning a compile error during a compile. I've
placed <<>> around the line that the debugger points to. Any ideas? Thanks in
advance!

Function Strip(vPhrase, sBadChars As String)
' Purpose: remove any of the characters in sBadChars from vPhrase
Dim sPhrase As String
Dim i As Integer

If IsNull(vPhrase) Or IsEmpty(vPhrase) Or Len(sBadChars) = 0 Then
Strip = vPhrase
Else
sPhrase = vPhrase
i = 1
Do Until i > Len(sPhrase)
<< Do Until InStr(sBadChars, Mid$(sPhrase, i, 1)) = 0 Or i >
Len(sPhrase) >>
sPhrase = Left$(sPhrase, i - 1) & Mid$(sPhrase, i + 1)
Loop
i = i + 1
Loop
Strip = sPhrase
End If
End Function
 
JohnLute said:
I have a module that's returning a compile error during a compile. I've
placed <<>> around the line that the debugger points to. Any ideas? Thanks in
advance!

Function Strip(vPhrase, sBadChars As String)
' Purpose: remove any of the characters in sBadChars from vPhrase
Dim sPhrase As String
Dim i As Integer

If IsNull(vPhrase) Or IsEmpty(vPhrase) Or Len(sBadChars) = 0 Then
Strip = vPhrase
Else
sPhrase = vPhrase
i = 1
Do Until i > Len(sPhrase)
<< Do Until InStr(sBadChars, Mid$(sPhrase, i, 1)) = 0 Or i >
Len(sPhrase) >>
sPhrase = Left$(sPhrase, i - 1) & Mid$(sPhrase, i + 1)
Loop
i = i + 1
Loop
Strip = sPhrase
End If
End Function

It compiled fine for me. It even worked on the example I tried:

Strip("Hello World!", "Hr!") => ello Wold (Australian?)

That translator is not perfect :-). For instance, IIRC, the British
generally pronounce the "h" in herbal.

James A. Fortune
(e-mail address removed)
 
Back
Top