minibuffer

How to get the substring of a string in Emacs Lisp?

October 12, 2023
"foo bar baz"

(substring "foo bar baz" 0 3) ;; "foo"
(substring "foo bar baz" 4) ;; "bar baz"
(substring "foo bar baz" -7 -4) ;; "bar"
(substring "foo bar baz" -3) ;; "baz"