Function: make-string count character
ELISP> (make-string 5 ?x)
"xxxxx"
substring string start &optional end
ELISP> (substring "abcdefg" 0 3)
"abc"
ELISP> (substring "abcdefg" -3 -1)
"ef"
ELISP> (substring "abcdefg" -3 )
"efg"
ELISP> (substring "abcdefg" -3 nil)
"efg"
ELISP> (substring "abcdefg" 0)
"abcdefg"
ELISP> (concat "The " "quick brown " "fox.")
"The quick brown fox."
ELISP>
ELISP> (mapconcat 'identity '("aaa" "bbb" "ccc") ",")
"aaa,bbb,ccc"
ELISP> (split-string "aaa,bbb,ccc" ",")
ELISP> (split-string "aaa,bbb,ccc" ",")
("aaa" "bbb" "ccc")
Function: split-string string &optional separators omit-nulls trim
ELISP> (split-string " two words ")
("two" "words")
ELISP> (split-string "hello_world" "_" t)
("hello" "world")
(apply #'concat '("hello, " "world"))
==> "hello, world"
(string= "abc" "ABC")
⇒ nil
(string< "abc" "abd")
⇒ t
(format "The name of this buffer is %s." (buffer-name))
⇒ "The name of this buffer is strings.texi."
downcase
, upcase
(downcase "The cat in the hat")
⇒ "the cat in the hat"
(upcase "The cat in the hat")
⇒ "THE CAT IN THE HAT"
capitalize
(capitalize "THE 77TH-HATTED CAT")
⇒ "The 77th-Hatted Cat"
把c风格的变量trans_amount改为Camal风格的变量TransAmount
(defun bohao-camal-variable ()
(interactive)
(let ((str (thing-at-point 'symbol)))
(insert " " (apply 'concat
(mapcar 'capitalize (split-string str "_"))))))
(thing-at-point thing)
---------- Buffer: foo ----------
Gentlemen may cry ``Pea∗ce! Peace!,''
but there is no peace.
---------- Buffer: foo ----------
(thing-at-point 'word)
⇒ "Peace"
(thing-at-point 'line)
⇒ "Gentlemen may cry ``Peace! Peace!,''\n"
(thing-at-point 'whitespace)
⇒ nil