Function: string-lines
string-lines is an autoloaded and byte-compiled function defined in
subr-x.el.gz.
Signature
(string-lines STRING &optional OMIT-NULLS)
Documentation
Split STRING into a list of lines.
If OMIT-NULLS, empty lines will be removed from the results.
Other relevant functions are documented in the string group.
Probably introduced at or before Emacs version 28.1.
Shortdoc
;; string
(string-lines "foo\n\nbar")
=> ("foo" "" "bar")
(string-lines "foo\n\nbar" t)
=> ("foo" "bar")
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/subr-x.el.gz
;;;###autoload
(defun string-lines (string &optional omit-nulls)
"Split STRING into a list of lines.
If OMIT-NULLS, empty lines will be removed from the results."
(split-string string "\n" omit-nulls))