Function: urlcat

Documentation

Concatenate urls. Empty urls like `//' are collapsed into `/'. The resulting url will conform to the form of /<string1>/<string2>.../<string-n> That is, with `/' before, but not after. Series of empty strings "" results in empty string.

Source

(defun urlcat (&rest urls)
  "Concatenate urls. Empty urls like `//' are collapsed into `/'. The
resulting url will conform to the form of

/<string1>/<string2>.../<string-n>

That is, with `/' before, but not after.

Series of empty strings \"\" results in empty string. "
  (ensure-prefix-slash-only
   (regex-replace-all "/+"
		      (apply #'strcat
			     (mapcar #'ensure-prefix-slash urls))
		      "/")))
Source Context