use vl-string-translate convert unwanted charters to space (or some other charter you will not use) and then remove those charters from the string.
;;----------------------------------------------------------------------------;;
;; Removes leading, traling, and double spaces
(defun RemoveGaps (str)
(while (/= str (setq str (vl-string-subst " " " " str))))
(vl-string-trim " " str)
)