2

On python, you can repeat a value several times inside a string when formatting it:

>>> print "Hello, {name}, how are you, {name}?".format(name="George") "Hello, George, how are you, George?" 

But I don't know how to achieve this with elisp. I'm trying to make a function that returns the GPLv3 copyright text (This file is part of Foobar. Foobar is free software:) with the name of any projectile project on it.

1
  • A simpler answer to the title of the question itself without the “named” string substitution part: format supports specifying the number of a field. That is, (format "%1$d, %1$d, %2$d, %2$d" 5 7) evaluates to "5, 5, 7, 7". See M-x describe-function of format. Commented Jan 9 at 12:00

1 Answer 1

0

Still another solution:

(let ((name "George")) (format "%s" (concat "Hello, " name ", how are you, " name "?"))) 

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.