jjk
jjk

Reputation: 595

How to get the second word in string in emacs lisp?

(message %s) > "foo bar"

How can I only print "bar"?

Upvotes: 0

Views: 369

Answers (1)

Steve Vinoski
Steve Vinoski

Reputation: 20024

First split the string, then grab the element you want from the resulting list:

(message "%s" (nth 1 (split-string "foo bar")))

Upvotes: 2

Related Questions