LotusScript Version of JavaScript-Escape
When passing arguments in URLs on the Web, you must ensure that all characters are "Web-safe". This LotusScript function performs the eqivalent of a JavaScript-Escape.
Function LSescape(strIn As String) As String
'
' This function performs the equivalent of a JavaScript escape.
' Kenneth H?man, TJ Group AB.
'
Dim strAllowed As String
Dim i As Integer
Dim strChar As String
Dim strReturn As String
'These are the characters that the JavaScript escape-function allows, so we let them pass
'unchanged in this function as well.
strAllowed = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" & "@/.*-_"
i = 1
strReturn = ""
While Not (i > Len(strIn))
strChar = Mid$(strIn, i, 1)
If Instr(1, strAllowed, strChar) > 0 Then
strReturn = strReturn & strChar
Else
strReturn = strReturn & "%" & Hex$(Asc(strChar))
End If
i = i + 1
Wend
LSescape = strReturn
End Function