Skip to content

Split a string into lines

SimonLSchlee edited this page Jun 10, 2020 · 3 revisions

Split a string into lines (skipping empty lines)

|Artifacts|

(regexp-split "\n+" str)
(string-split str #rx"\n+")  ;; string-split also accepts regular expressions

#rx"..." and #px"..." are literal notations for regular expressions Reading Regular Expressions

Split a string into lines (keeping empty lines)

(string-split str "\n")
Clone this wiki locally