summaryrefslogtreecommitdiff
path: root/dev
diff options
context:
space:
mode:
authorlujun9972 <lujun9972@gmail.com>2016-04-29 21:41:25 +0800
committerlujun9972 <lujun9972@gmail.com>2016-04-29 21:41:25 +0800
commit44cb8b7c89fa2bd77709717b95aee2e661d82aba (patch)
treeada4f1e3f1f500e02636b30ff55d053569cca9f7 /dev
parentf5e0457e88ec87aee7989e99609ec960c435557d (diff)
The key and value could be not string
Diffstat (limited to 'dev')
-rw-r--r--dev/examples.el9
1 files changed, 8 insertions, 1 deletions
diff --git a/dev/examples.el b/dev/examples.el
index 1ef3680..e21db3c 100644
--- a/dev/examples.el
+++ b/dev/examples.el
@@ -309,7 +309,7 @@
(s-presence "foo") => "foo")
(defexamples s-format
- ;; One with an alist works
+ ;; One with an alist works
(s-format
"help ${name}! I'm ${malady}"
'aget
@@ -331,6 +331,13 @@
#s(hash-table test equal data ("name" "nic" "malady" "on fire")))
=> "help nic! I'm on fire"
+ ;; Don't have to be string
+ (s-format "I'm ${name}, ${sex}, ${age} years old"
+ 'aget
+ '((name . "Nick") (sex . male) (age . 2)))
+ => "I'm Nick, male, 2 years old"
+
+
;; Replacing case has no effect on s-format
(let ((case-replace t))
(s-format "help ${NAME}!" 'aget '(("NAME" . "Nick"))))