Accessing location search paramters the Smalltalk way

10 views
Skip to first unread message

Tom

unread,
Mar 20, 2012, 6:33:03 AM3/20/12
to amber-lang
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...
Reply all
Reply to author
Forward
0 new messages