QueryStringUtil

Kind of class:class
Inherits from:none
Version:05/30/07
Author:Aaron Clinger
Classpath:org.casaframework.util.QueryStringUtil
File last modified:Sunday, 19 August 2007, 13:43:36
Utilities for converting field-value query strings to and from Objects.

Summary

Class methods

Class methods

decode

static function decode (query:String, separator:String) : Object
Converts a query string of field-value pairs to an Object.
Parameters:
query :
String composed of a series of field-value pairs.
separator:
[optional] The string that separates the field-value pairs; defaults to "&".
Returns:
Returns Object composed of defined variables Strings.
Usage note:
Method automatically unescape's values.
Usage:
var fieldValues:Object = QueryStringUtil.decode("name=Aaron&id=13");
trace(fieldValues.name);
trace(fieldValues.id);

encode

static function encode (data:Object, separator:String) : String
Converts an Object's first level variables into field-value pairs.
Parameters:
data :
Object that contains variables to convert to field-value pairs.
separator:
[optional] The string that separates the field-value pairs; defaults to "&".
Returns:
Returns a query string.
Usage:
var dataToSend:Object = new Object();
dataToSend.id = 13;
dataToSend.name = 'Aaron';

trace(QueryStringUtil.encode(dataToSend));