Function: denote-slug-hyphenate

denote-slug-hyphenate is a byte-compiled function defined in denote.el.

Signature

(denote-slug-hyphenate STR)

Documentation

Replace spaces and underscores with hyphens in STR.

Also replace multiple hyphens with a single one and remove any leading and trailing hyphen.

Aliases

denote--slug-hyphenate (obsolete since 4.0.0)

Source Code

;; Defined in ~/.emacs.d/elpa/denote-4.2.3/denote.el
(defun denote-slug-hyphenate (str)
  "Replace spaces and underscores with hyphens in STR.
Also replace multiple hyphens with a single one and remove any
leading and trailing hyphen."
  (replace-regexp-in-string
   "^-\\|-$" ""
   (replace-regexp-in-string
    "-\\{2,\\}" "-"
    (replace-regexp-in-string "_\\|\s+" "-" str))))