[urlparams]: Creating Query Strings

[urlparams] is an object for creating query strings. It takes a series of key/value pairs at its inlet and outputs these as one symbol. Special characters in both key and value are URL encoded.

Storing Data with [add(

The [add( message needs at least two parameters: key and value. Any additional parameters are concatenated to the value with a space. A key/value pair is output with a = separator, while all key/value pairs are concatenated with a & . Special characters will be URL encoded.

Adding a value with an already stored key will result in overwriting the existing value.

Examples:

  • [add key 1( will store key=1
  • [add name My Name( will store name=My%20Name
  • [add key 1( , [add name My Name( , [add key 2( will store key=2&name=My%20Name
  • [add key @me with #hashtag( will store key=%40me%20with%20%23hashtag

Outputting And Clearing Data

Issuing a [bang( message to [urlparams] will output the stored key/value pairs as string on its only outlet. If no data is stored, an empty symbol is sent.

You can clear the stored object with the [clear( method.