In one of my Emacs libraries, in which I send HTTP requests to a website, I have something like this:
(if (string-match "\\?" request) "&" "?") ; this is hackish
(the purpose is clear if you know how the URIs are structured). As the comment says, I actually considered this rather a duct-tape approach…
…until I found this gem in request.el
:
(setq url (concat url (if (string-match-p "\\?" url) "&" "?") ...))
Duct tape works anywhere. Duct tape is magic and should be worshipped. (Andy Weir, The Martian)