lisp使用雙引號表示字串字面量
如果要包含雙引號用''轉義cl-user> "abc"
"abc"
如果包含''本身,也需要'' 轉義cl-user> "a\"bc"
"a\"bc"
插入變數cl-user> "a\\bc"
"a\\bc"
第三方cl-interpol包可以把乙個變數的值插入字串中
1.安裝
(ql:quickload :cl-interpol)
2.開啟插值語法
(cl-interpol:enable-interpol-syntax)
3.插入值
插入非可列印字元cl-user> (let ((a 100)) #?"$(a)個")
"100個"
cl-interpo不僅可以插入變數值,還可以插入非可列印字元
1.連線cl-user> #?"\n"""
cl-user>
2.遍歷字串cl-user> (concatenate 'string "abc" "def")
"abcdef"
正規表示式需要第三方的包,下面以cl-ppcre為例cl-user> (loop for c across "abcdefg" do (print c))
#\a
#\b
#\c
#\d
#\e
#\f
#\g
nil
1.安裝
(ql:quickload :cl-ppcre)
2.匹配
cl-user> (cl-ppcre:scan-to-strings "((a)bc)" "abcdef")
"abc"
#("abc" "a")
字串操作 靠字串分割字串
字串分解函式。注意strtok比較複雜。要妥善運用!也可以不用strtok函式,但要實現字串靠字串分割比較困難!注意str指向的空間必須是可讀可寫的 如陣列或動態分配的空間 不能為字串常量的指標,因為strtok改變了其中的內容。include include 功能 將str中的字串按照elemon...
Golang 字串型別和字串操作
package main import fmt func main 標準輸出 bo y 我來自 t中國package main import fmt func main 標準輸出 我叫boy false true true true false false truepackage main impo...
ORACLE in 字串,字串,字串
因為傳進來的引數是 字串,字串,字串,要實現in 字串,字串,字串 select from htl price p where p.hotel id 30073328 and p.able sale date between to date 2009 03 27 yyyy mm dd and to ...