Reverse / Replace Slashes in a String

Author: Tripp W Black

Created: 02/27/2001 at 01:24 PM

 

Category:
Notes Developer Tips
LotusScript

This function reverses a slash in a string. (Similar to @ReplaceSubString in Formula language)

Function ReverseSlashes(filename As String) As String
Dim szReturn As String
Dim fn As String
Dim index As Integer

fn = filename
index = Instr(1, fn, "\")

If (index = 0) Then
ReverseSlashes = filename
Exit Function
End If

While index <> 0
szReturn = Left$(fn, index - 1)
szReturn = szReturn + "/" + Mid$(fn, index + 1)
fn = szReturn
index% = Instr(1, fn, "\")
Wend

ReverseSlashes = szReturn
End Function

previous page