Ernest Leyva commented on Mar 18, 2009

Quesy String Parser V2.0

Hi

Thanks for the comment. This is the fixed version of the code. It also changed the parameters to make it slightly easier to invoke:

Function parseQS( session as NotesSession, params List As String ) As Integer

Dim buffer As Variant, pair As Variant, ceiling As Integer, i As Integer

On Error Resume Next

Erase params

buffer = Split( session.DocumentContext.Query_String(0) , "&" )

ceiling = Ubound( buffer )

For i=0 To ceiling

pair= buffer(i)

params( Lcase( strToken( pair, "=", 1, 5 ) ) ) = strToken( pair, "=", 2, 5 )

Next

parseQS = ceiling

End Function

Tommy Valand commented on Nov 6, 2008

Parameters with multiple =

There is a potential flaw in your routine. It doesn't fetch the entire value if there are = inside a parameter-value.

E.g. { Link }

Safer way:

'Split the querystring on "&" -> parameters

Forall parameter in parameters

name = Strtoken( parameter, "=", 1 )

params( name ) = Replace( parameter, name+"=", "" )

End Forall