伍星
发表于 2022-8-15 14:16:52
我等菜鸟的福音,太需要这样的资料了
yanchao316
发表于 2022-8-15 14:19:21
谢谢分享。。。
d1742647821
发表于 2022-8-15 14:20:28
强!!!!
insipid
发表于 2022-8-15 14:21:17
谢谢猫老师,感谢分享。
这只胆小鬼
发表于 2022-8-15 14:25:01
谢谢猫老师,感谢分享。
xiaotao
发表于 2022-8-15 14:33:15
感谢猫老师,先回复再看看
紫苏炒黄瓜
发表于 2022-8-15 14:34:07
先顶后看,感谢分享
自贡黄明儒
发表于 2022-8-15 14:38:10
本帖最后由 自贡黄明儒 于 2022-9-17 13:55 编辑
谢谢猫老师,感谢分享。
;;[功能]去掉之字符串小数点后字符
命令: (tranf 'filename-non-extension)
T
命令: (filename-non-extension "D:\\1.txt")
"D:\\1"
命令: (filename-non-extension "D:\\1.txt.txt")
"D:\\1.txt"
;;[功能]文件名分成三部分
(tranf 'as:fnsplitl)
(as:fnsplitl "D:\\0000\\1.txt");==>("D:\\0000\\" "1" ".txt")
(fnsplitl "D:\\0000\\1.txt.txt");==>("D:\\0000\\" "1.txt" ".txt")
;;参考as:fnsplitl
;;[功能]lisp编辑器无法再编辑??
(tranf 'sys-top);==>T
(sys-top)
;;[功能]盘符序列号
(tranf 'FIND_SERIALNUMBER);;==>T
(FIND_SERIALNUMBER "c:")
(FIND_SERIALNUMBER "D:\\")
;get-logical-drives
;;[功能]盘符
(tranf "get-logical-drives")
(get-logical-drives)
(tranf "_read-nb")
(tranf "_write-nb-str")
;;;(setq fname (findfile "D:\\0000\\1.lsp"))
;;;(setq f (open fname "r"))
;;;(setq str (_read-nb 64000000 f))
;;;(close f)
;;[功能]文件大小(多少字节),同vl-file-size
(tranf "file-size")
(file-size "D:\\0000\\1.txt")
(tranf "file-mod-time")
(tranf "file-read-only-p")
(tranf "file-readable-p")
(file-mod-time "D:\\0000\\1.txt");不知这个时间怎么搞
(file-read-only-p "D:\\0000\\1.txt");只读为T
(file-readable-p "D:\\0000\\1.txt");可读
(tranf "member-if")
(tranf "member-if-not")
(member-if 'numberp '("a" 1 "a" 1))
(member-if 'numberp '("a" "a" 1 "a" 1));==>(1 "a" 1)
(tranf "merge")
(merge '(1 2) '(4 5) +);==>(4 5 1 2)
(merge '((1) 2) '((3)(3)) 'append);==>((3) (3) (1) 2)
;;(if (member item list) list (cons item list))
(tranf "adjoin")
(adjoin 2 '(3 5));==>(2 3 5)
(adjoin 2 '(3 5 2));==>(3 5 2)
;;不好用,只能三个参数,最后一个须是表
(tranf "acons")
(acons 1 2 '(3));==>((1 . 2) 3)
(tranf "butlast")
(butlast '(1 2 3 4));==>(1 2 3)
;;类似VBS中的写法了
(tranf "funcall")
(funcall '+ 1 2 3)
(funcall + 1 2 3);==>6
(tranf "reduce")
(reduce '+ '(1 2 3) 4);==>10
(tranf "make-list")
(make-list 5 4);==>(4 4 4 4 4)
(make-list 5);==>(nil nil nil nil nil)
;;相当于append
(tranf "nconc")
(nconc '(1 2) '(2) 3);==>(1 2 2 . 3)前面必须是表
(nconc '(1 2) '(2) '(3 4));>>(1 2 2 3 4)
(nconc '(1 2) '(1 2));(1 2 1 2)
;;只能两个参数表;前面一个表倒置了
(tranf "nreconc")
(nreconc '(1 2) '(3 4));==>(2 1 3 4)
(nreconc '(1 2) 3);==>(2 1 . 3)
;;只能是点对中搜索,按后一个元素搜索
(tranf "rassoc")
(rassoc 'a '((a . b) (b . c) (c . a) (z . a)));==>(C . A)按后一个元素搜索
(rassoc 3 '((1 . 2) (3 . 2) (4 . 3) (5 . 3)));(4 . 3)
(assoc 3 '((1 2) (3 2) (4 3) (5 3)));==>(3 2)这个可以是表
;;换第一个元素
(tranf "rplaca")
(rplaca '(1 2 3 4) 5);==>(5 2 3 4)
;;(cons (car x) lst)
(tranf "rplacd")
(rplacd '(3 2 3 4) 5);==>(3 . 5)取第一个元素组成点对
(rplacd '(3 2 3 4) '(5 0 1));(3 5 0 1)
(tranf "string->list")
(string->list "A自");(65 215 212)同(VL-STRING->LIST "A自") "12自贡3"
(tranf "string-append")
(string-append "A自" "3" "3");"A自33",相当于strcat
(tranf "string-by-char-to-list")
(string-by-char-to-list "AAb3b3自" (ascii "b"));("AA" "3" "3自")
;;不支持中文
(string-by-char-to-list "AAb自3b自3自" (ascii "自"));("AAb" "?b" "?" "
;;首字母大写
(tranf "string-capitalize")
(string-capitalize "hello,world");"Hello,World"
(string-capitalize "hello,world")
;;大写(不如strcase好用)
(tranf "string-upcase")
(string-upcase "hello,world自");"HELLO,WORLD自"
(strcase "hEllo,world自" t);"hello,world自"
;;计数
(tranf "string-count")
(string-count (ascii "b") "自ababc");2 "b"的数量
(tranf "string-downcase")
(string-downcase "Hello,World");"hello,world"
;;(VL-STRING->LIST "Hello,World");(72 101 108 108 111 44 87 111 114 108 100)
(tranf "string-elt");字符串中的位移。第一个字符的位移为 0
(string-elt "Hello,World" 2);108
(tranf "string-elt<-")
(setq a "hello")
(string-elt<- a 65 2);此时a 变成了"heAlo"
;;猜不出
(tranf "string-expand-clip")
(string-expand-clip "Hello,World")
;;是否有前缀
(tranf "string-has-prefix-p")
(string-has-prefix-p "hello" "he");T 区分大小写
(tranf "string-left-trim")
(string-left-trim "he" "hello");"llo" 同VL-STRING-LEFT-TRIM
;;字符串长度
(tranf "string-length")
(string-length "hello");5
(string-length "hello自");7 看来中文还是按2个长度计算的。
(strlength "hello自")
;;不好猜
(tranf "string<")
(string< "Atxt" "bbb");t
(string< "aaaaaaa" "bb" "bbb");t
;;是否字符串
(tranf "stringp")
(stringp "2Atxt");t
(stringp 2);nil
(stringp (car(entsel)));nil
;;字符串是否相同
(tranf "string=")
(string= "2Atxt" "2Atxt" "2Atxt");t
(string= "ABC" "abc");nil 区分大小写
;;[功能]只能比较字符串,不区分大小写
(tranf "string-equal")
(string-equal ".Fas" ".fas" ".fAs");===>T
(string-equal ".fas" "a.Fas");===>nil
;;前后剪切
(tranf "string-trim")
(string-trim" .F" " .Fa sF ");" .Fas " 同VL-STRING-TRIM
(VL-STRING-TRIM" .F" " .Fa sF ")
(tranf "string-right-trim")
;;字符串填充
(tranf "string-fill")
(setq a "abc")
(string-fill a 65);!a==>"AAA"
;;(chr 65)==>"A"
;;string-key-value
;;string-lessp
;;string-mismatch
;;string-position
;;string-psubst
;;string-resource
;;string-search
;;string-subseq
;;string-subst
;;string-translate
mituzhe
发表于 2022-8-15 14:39:14
来学习学习
hpy
发表于 2022-8-15 14:40:41
感谢分享!
页:
1
2
3
[4]
5
6
7
8
9
10
11
12
13