Function: string-remove-prefix

string-remove-prefix is a byte-compiled function defined in subr-x.el.gz.

Signature

(string-remove-prefix PREFIX STRING)

Documentation

Remove PREFIX from STRING if present.

Other relevant functions are documented in the string group.

Probably introduced at or before Emacs version 24.4.

Shortdoc

;; string
(string-remove-prefix "foo" "foobar")
    => "bar"

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/subr-x.el.gz
(defsubst string-remove-prefix (prefix string)
  "Remove PREFIX from STRING if present."
  (if (string-prefix-p prefix string)
      (substring string (length prefix))
    string))