I get this error: (Global): Replace: 1: Unexpected: Replace; Expected: Identifier
Here is the code:
Public Function Replace( Byval InString, Byval ReplString, Byval WithString )
'Purpose: Replaces all occurrences of <ReplString> in <InString> with <WithString>
On Error Goto TrapError
While Not InString = ""
If Left( InString, Len( ReplString ) ) = ReplString Then
Result = Result & WithString
InString = Right( InString, Len( InString ) - Len( ReplString ) )
Else
Result = Result & Left( InString, 1 )
InString = Right( InString, Len( InString ) -1 )
End If
Wend
Replace = Result
Exit Function
Replace(sourceArray as Variant, findArray as Variant, replacementArray as Variant[, start as Integer[, count as Integer[, compMethod as Integer]]]) as Variant
“”
so to solve this yopu should rename the function to sReplace or something
For the benefit of other searchers like me for whom this is the most relevant thread searching on “Replace” and “Unexpected” : This message also results if you use “Replace” as a subroutine as in
Replace is a Lotusscript function. Call your function something else.
You should also be more clear about whether the error occurs at compile-time or at run-time.
Replace(sourceArray as Variant, findArray as Variant, replacementArray as Variant[, start as Integer[, count as Integer[, compMethod as Integer]]]) as Variant