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

Dig Deeper on Domino Resources

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close