Function: url-parse-query-string

url-parse-query-string is an autoloaded and byte-compiled function defined in url-util.el.gz.

Signature

(url-parse-query-string QUERY &optional DOWNCASE ALLOW-NEWLINES)

Source Code

;; Defined in /usr/src/emacs/lisp/url/url-util.el.gz
;;;###autoload
(defun url-parse-query-string (query &optional downcase allow-newlines)
  (let (retval pairs cur key val)
    (setq pairs (split-string query "[;&]"))
    (while pairs
      (setq cur (car pairs)
	    pairs (cdr pairs))
      (unless (string-search "=" cur)
        (setq cur (concat cur "=")))

      (when (string-match "=" cur)
        (setq key (url-unhex-string (substring cur 0 (match-beginning 0))
                                    allow-newlines))
        (setq val (url-unhex-string (substring cur (match-end 0) nil)
                                    allow-newlines))
        (if downcase
            (setq key (downcase key)))
        (setq cur (assoc key retval))
        (if cur
            (setcdr cur (cons val (cdr cur)))
          (setq retval (cons (list key val) retval)))))
    retval))