Emacs Lisp: Format String

By Xah Lee. Date: . Last updated: .
(format STRING &rest OBJECTS)
Convert lisp objects into a string. It takes a input string, and several other arguments of lisp objects, and output a string.
(format "Name: %s, age: %d"
;; "Name: jane, age: 25"
string. Converted by princ. [see Emacs Lisp: Print, Output]
number in decimal.
number converted to octal notation.
number converted to hexadecimal notation.
like %x, but uses upper case.
number in exponential notation.
number in decimal-point notation.
number in exponential notation or decimal-point notation, whichever uses fewer characters.
number as a single character.
any object in lisp syntax (using prin1). [see Emacs Lisp: Print, Output]

(info "(elisp) Formatting Strings")

Emacs Lisp String

Lisp Basics

Lisp Basics


Lisp Data Structure


Lisp Symbol

Lisp Misc

Working with Elisp