Function: string-chop-newline

string-chop-newline is a byte-compiled function defined in subr-x.el.gz.

Signature

(string-chop-newline STRING)

Documentation

Remove the final newline (if any) from STRING.

Other relevant functions are documented in the string group.

Probably introduced at or before Emacs version 28.1.

Shortdoc

;; string
(string-chop-newline "foo\n")
    => "foo"

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/subr-x.el.gz
(defun string-chop-newline (string)
  "Remove the final newline (if any) from STRING."
  (string-remove-suffix "\n" string))