Accessing location search paramters the Smalltalk way

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Accessing location search paramters the Smalltalk way

Ankh'nAton
Hi all :)

I'd like to create a one page project with Amber, where that page
calls itself changing state upon the parameters in...

  window location search

...if needed. Therefor I want all of these parameters accessible in a
Dictionary, in Smalltalk terms. Here's what I came up with...

        | query pair |
        query := Dictionary new.
        ((document location search trimLeft: '?') tokenize: '&') do: [ :tok |
                pair := tok tokenize: '='.
                query
                        at: pair first
                        put: pair second.
        ].
        ^query.

As this looks a bit monstrous to me, I wonder if it could be done more
compact?

Cheers...