Example #1
0
File: url.go Project: mnhkahn/cygo
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
}
Example #2
0
File: url.go Project: mnhkahn/cygo
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
}