Exemple #1
0
func ParseQuery(query string) Values {
	m := make(Values)
	var k, v string
	var queryKeyValue = func(q string) {
		k, v = "", ""
		i := strings.Index(q, "=")
		if i != -1 {
			k = q[:i]
			if i+1 <= len(q) {
				v = q[i+1:]
			}
			m.Add(k, v)
		}
	}

	cystr.SplitEachAfter(query, "&", queryKeyValue)

	return m
}
Exemple #2
0
func (this *URL) Query() Values {
	m := make(Values)
	var k, v string
	var queryKeyValue = func(q string) {
		k, v = "", ""
		i := strings.Index(q, "=")
		if i != -1 {
			k = q[:i]
			if i+1 <= len(q) {
				v = q[i+1:]
			}
			v, _ = url.QueryUnescape(v)
			m.Add(k, v)
		}
	}

	cystr.SplitEachAfter(this.RawQuery, "&", queryKeyValue)

	return m
}