更新!!掀开“桌子”,从CAD中挖掘出全部Lisp函数,普通及内部函数变量10000+
本帖最后由 不死猫 于 2022-8-16 11:32 编辑近期在论坛看到有零散的内部函数公布,大家热情高涨,但个人研究毕竟能力有限,从内存翻找内部函数效率也很低,不如集思广益让更多的爱好者参与,所以猫老师把自己挖掘整理好的函数(普通+内部+全局变量)共享出来,一共5400余个,应该也是截至目前为止全网发布最多的原生AutoCAD-Lisp函数合集。
=============================
第一版发布后,重新整理发现了更多资源,共计10000多个,做一次更新。
猫老师的部分研究说明:
1. 结尾是p的,大多是用来判断是否某种类型的,所以可以根据这个找到一些内部类型。
例如我们平时有用的listp,这里可以找到例如vectorp(向量表判断)、usubrp(用户函数判断)、stringp(字符串判断)等等
2. 带叹号的函数有些和窗体有关
3. 前后星号是CAD全局变量
4. N开头的有些是破坏性函数(破坏性列表操作是指那些改变了内存单元内容的操作)
5. ac开头是常量
6. as:开头的是一些我们正常用到函数的内部名称,但是一些内部函数和现有函数名称相同但用法不同,使用时要注意
7. 冒号开头的是符号参数,我们平时用到比较多的是反应器里面
本套函数大全中有很多底层操作的函数,包括多种数据类型、内存读写、向量、命名空间、二进制、函数、变量、包、数据流、堆栈、缓冲区、矩阵、文件处理、com接口、数据库、动态链接库、丰富的字符串、表和数字处理等无法一一列举。
注意:很多函数的使用具有不可预见性,例如random&随机数获取,我在Lisp加密工具的早期版本中使用发现,循环调用80-100万次时(非单独循环调用),该函数会崩溃。另外有的函数受到操作系统、CAD版本的影响,功能和返回值会有变化,后续大家发布函数功能的时候需要注意测试!
抗反编译方面:因为内部函数在lsp中不能普遍存在,因此具有一点抗反编译能力。
某些函数不存在的问题:要加载特定的arx文件。
猫老师函数大全下载:
**** Hidden Message *****
发一个我自己写的转换内部函数代码。
(defun ggload(str / ado array f file_list fileget lst);猫老师内部函数生成
(setq out (strcat (getenv "UserProfile") "\\内部函数.fas"))
(if (findfile out)
(vl-file-delete out)
)
(setq lst (append
(list 13 70 65 83 52 45 70 73 76 69 59 195 168 192 207 202 166 13 49 13 49 32 36 7 36 13 )
(vl-string->list (itoa (+ 26 (strlen str) (strlen str))))
(list 32 50 32 36 )
(list 20 1 1 1 0 86 )
(vl-string->list str)
(list 0 0 91 )
(vl-string->list (vl-string-subst "-" "." str))
(list 0 0 1 67 0 0 2 0 10 3 0 0 11 6 1 0 22 36)))
(setq File_list lst)
(setq array (vlax-make-safearray 17 (cons 0 (1- (length File_list)))))
(setq FileGet (vlax-make-variant (vlax-safearray-fill array File_list) 8209))
(Setq ADO (Vlax-Get-Or-Create-Object "ADODB.Stream" ))
(Vlax-Put-Property ADO 'Type 1 )
(Vlax-Invoke ADO 'Open )
(Vlax-Put-Property ADO 'Position 0 )
(Vlax-Invoke-Method ADO 'Write FileGet)
(Vlax-Invoke ADO 'SaveToFile Out 2)
(Vlax-Invoke-Method ADO 'Close )
(vlax-release-object ADO)
(print (load Out))
)
调用方法:
(ggload "nthcdr")
为方便讨论,建一个讨论群,后续可以共同讨论函数说明
发一点测试的代码仅供参考:
(get_FileSize "d:\\1.txt")
(get-logical-drives)
(filename-beautify "d:\\1.txt")
(filename-directory "d:\\1.txt")
(filename-non-extension "d:\\1.txt")
(current-date-string)
(current-time-string)
(_lisp-size "123")
(_fullpath "")
(_days-after-96)
(Current-document-lisplet)
(FAS-conf->dword 1 4)
(shell "notepad") 这个代替startapp不弹窗
(setq a "(1 2 3)")
(ads-getsym "a")
(lresb->reslist (reslist->lresb '("1" "2" "3")))
(prv-build (prv-fetch "D:\\Lisp加密\\43797405\\mi\\namespace.prv") ) 用Lisp实现全自动编译VLX
(nthcdr 1 '(1 2))
(list-elt '(1 2) 0)
(reader-whitespace)
(read-word (make-string-input-stream "123"))
(_vl-fast-mode 'tt)
(intern 'tt (init:AUTOLISP-package))
(type-of (Current-document-lisplet))用来识别各类内部类型
(xsubr-offs (closure-procedure _load-lisplet-vlx))
(_streambuf-string (_istream-buf *standard-input*))
(_streambuf-string (_ostream-buf *standard-output*))
(yes-or-no-p "发现新版本是否升级?") 需要加载vlide的arx文件
(ACAD)
(COS 4)
(car& '(1))
(_lisp-size "12")
(eqcar '(1) 1) 下面是一些表处理
(rplacd '(6 6 6 ) '(2 3 4 5 6))
(rplaca '(6 6) '(2 3 4 5 6))
(wcons 1 '(2))
(ncons '(1))
(xcons '(1) 2)
(acons 1 '(2) '(3))
(setcar(list 2 3) '(2))
(setcdr (list 2 3) '(2) )
(revappend '(1 2 3) '(4 5 6))
(lisplet-reference->string (lisplet-reference (Current-document-lisplet)))
(_symbol-lso-list)
(string-by-char-to-list "1,2,3" (ascii ","))字符串拆分
(_streambuf-string (_istream-buf *standard-input*))获取命令行内容
另外把电脑时间改到2035年以后,打开CAD,系统时间会被修改,都是在测试内部函数时发现的有趣事情。
其他:
内部函数的发现源自于反编译(编译Fas后,CAD会把部分代码转为内部函数调用)。
内部函数转换为用户函数的发现者是baitang36,他称为隐藏函数。我叫内部函数,因为这是桌子的“内库”。
用Lisp操作内存、汇编玩的较早是晨语。
希望以后有更多人发现好用的函数。
应该还有更多函数,后续慢慢挖。
本帖最后由 不死猫 于 2022-9-16 10:23 编辑
删除表中第几个元素
(setq lst '(1 2 3 4 5 6))
(list-elt<- lst "$$" 3)
(vl-remove "$$" lst)
有坑的函数:
例如nconc(由concatenate而来)是一个破坏性版本的append。
(setq a '(1 2 3))
(setq a (nconc a a))
会陷入自我循环卡死
common-lisp中所有操作符和变量共978个
-
&allow-other-keys
&aux
&bodya
&environment
&key
&optional
&rest
&whole
*
**
***
*break-on-signals*
*compile-file-pathname*
*compile-file-truename*
*compile-print*
*compile-verbose*
*debugger-hook*
*debug-io*
*default-pathname-defaults*
*error-output*
*features*
*gensym-counter*
*load-pathname*
*load-print*
*load-truename*
*load-verbose*
*macroexpand-hook*
*modules*
*package*
*print-array*
*print-base*
*print-case*
*print-circle*
*print-escape*
*print-gensym*
*print-length*
*print-level*
*print-lines*
*print-miser-width*
*print-pprint-dispatch*
*print-pretty*
*print-radix*
*print-readably*
*print-right-margin*
*query-io*
*random-state*
*read-base*
*read-default-float-format*
*read-eval*
*read-suppress*
*readtable*
*standard-input*
*standard-output*
*terminal-io*
*trace-output*
/
//
///
/=
+
++
+++
<
<=
=
>
>=
1-
1+
abort
abs
acons
acos
acosh
add-method
adjoin
adjustable-array-p
adjust-array
allocate-instance
alpha-char-p
alphanumericp
and
append
apply
apropos
apropos-list
aref
arithmetic-error
arithmetic-error-operands
arithmetic-error-operation
array
array-dimension
array-dimension-limit
array-dimensions
array-displacement
array-element-type
array-has-fill-pointer-p
array-in-bounds-p
arrayp
array-rank
array-rank-limit
array-row-major-index
array-total-size
array-total-size-limit
ash
asin
asinh
assert
assoc
assoc-if
assoc-if-not
atan
atanh
atom
base-char
base-string
bignum
bit
bit-and
bit-andc1
bit-andc2
bit-eqv
bit-ior
bit-nand
bit-nor
bit-not
bit-orc1
bit-orc2
bit-vector
bit-vector-p
bit-xor
block
boole
boole-1
boole-2
boolean
boole-and
boole-andc1
boole-andc2
boole-c1
boole-c2
boole-clr
boole-eqv
boole-ior
boole-nand
boole-nor
boole-orc1
boole-orc2
boole-set
boole-xor
both-case-p
boundp
break
broadcast-stream
broadcast-stream-streams
built-in-class
butlast
byte
byte-position
byte-size
caaaar
caaadr
caaar
caadar
caaddr
caadr
caar
cadaar
cadadr
cadar
caddar
cadddr
caddr
cadr
call-arguments-limit
call-method
call-next-method
car
case
catch
ccase
cdaaar
cdaadr
cdaar
cdadar
cdaddr
cdadr
cdar
cddaar
cddadr
cddar
cdddar
cddddr
cdddr
cddr
cdr
ceiling
cell-error
cell-error-name
cerror
change-class
char
char/=
char<
char<=
char=
char>
char>=
character
characterp
char-code
char-code-limit
char-downcase
char-equal
char-greaterp
char-int
char-lessp
char-name
char-not-equal
char-not-greaterp
char-not-lessp
char-upcase
check-type
cis
class
class-name
class-of
clear-input
clear-output
close
clrhash
code-char
coerce
compilation-speed
compile
compiled-function
compiled-function-p
compile-file
compile-file-pathname
compiler-macro
compiler-macro-function
complement
complex
complexp
compute-applicable-methods
compute-restarts
concatenate
concatenated-stream
concatenated-stream-streams
cond
condition
conjugate
cons
consp
constantly
constantp
continue
control-error
copy-alist
copy-list
copy-pprint-dispatch
copy-readtable
copy-seq
copy-structure
copy-symbol
copy-tree
cos
cosh
count
count-if
count-if-not
ctypecase
debug
decf
declaim
declaration
declare
decode-float
decode-universal-time
defclass
defconstant
defgeneric
define-compiler-macro
define-condition
define-method-combination
define-modify-macro
define-setf-expander
define-symbol-macro
defmacro
defmethod
defpackage
defparameter
defsetf
defstruct
deftype
defun
defvar
delete
delete-duplicates
delete-file
delete-if
delete-if-not
delete-package
denominator
deposit-field
describe
describe-object
destructuring-bind
digit-char
digit-char-p
directory
directory-namestring
disassemble
division-by-zero
do
do*
do-all-symbols
documentation
do-external-symbols
dolist
do-symbols
dotimes
double-float
double-float-epsilon
double-float-negative-epsilon
dpb
dribble
dynamic-extent
ecase
echo-stream
echo-stream-input-stream
echo-stream-output-stream
ed
eighth
elt
encode-universal-time
end-of-file
endp
enough-namestring
ensure-directories-exist
ensure-generic-function
eq
eql
equal
equalp
error
etypecase
eval
eval-when
evenp
every
exp
export
expt
extended-char
fboundp
fceiling
fdefinition
ffloor
fifth
file-author
file-error
file-error-pathname
file-length
file-namestring
file-position
file-stream
file-string-length
file-write-date
fill
fill-pointer
find
find-all-symbols
find-class
find-if
find-if-not
find-method
find-package
find-restart
find-symbol
finish-output
first
fixnum
flet
float
float-digits
floating-point-inexact
floating-point-invalid-operation
floating-point-overflow
floating-point-underflow
floatp
float-precision
float-radix
float-sign
floor
fmakunbound
force-output
format
formatter
fourth
fresh-line
fround
ftruncate
ftype
funcall
function
function-keywords
function-lambda-expression
functionp
gcd
generic-function
gensym
gentemp
get
get-decoded-time
get-dispatch-macro-character
getf
gethash
get-internal-real-time
get-internal-run-time
get-macro-character
get-output-stream-string
get-properties
get-setf-expansion
get-universal-time
go
graphic-char-p
handler-bind
handler-case
hash-table
hash-table-count
hash-table-p
hash-table-rehash-size
hash-table-rehash-threshold
hash-table-size
hash-table-test
host-namestring
identity
if
ignorable
ignore
ignore-errors
imagpart
import
incf
initialize-instance
inline
in-package
input-stream-p
inspect
integer
integer-decode-float
integer-length
integerp
interactive-stream-p
intern
internal-time-units-per-second
intersection
invalid-method-error
invoke-debugger
invoke-restart
invoke-restart-interactively
isqrt
keyword
keywordp
labels
lambda
lambda-list-keywords
lambda-parameters-limit
last
lcm
ldb
ldb-test
ldiff
least-negative-double-float
least-negative-long-float
least-negative-normalized-double-float
least-negative-normalized-long-float
least-negative-normalized-short-float
least-negative-normalized-single-float
least-negative-short-float
least-negative-single-float
least-positive-double-float
least-positive-long-float
least-positive-normalized-double-float
least-positive-normalized-long-float
least-positive-normalized-short-float
least-positive-normalized-single-float
least-positive-short-float
least-positive-single-float
length
let
let*
lisp-implementation-type
lisp-implementation-version
list
list*
list-all-packages
listen
list-length
listp
load
load-logical-pathname-translations
load-time-value
locally
log
logand
logandc1
logandc2
logbitp
logcount
logeqv
logical-pathname
logical-pathname-translations
logior
lognand
lognor
lognot
logorc1
logorc2
logtest
logxor
long-float
long-float-epsilon
long-float-negative-epsilon
long-site-name
loop
loop-finish
lower-case-p
machine-instance
machine-type
machine-version
macroexpand
macroexpand-1
macro-function
macrolet
make-array
make-broadcast-stream
make-concatenated-stream
make-condition
make-dispatch-macro-character
make-echo-stream
make-hash-table
make-instance
make-instances-obsolete
make-list
make-load-form
make-load-form-saving-slots
make-method
make-package
make-pathname
make-random-state
make-sequence
make-string
make-string-input-stream
make-string-output-stream
make-symbol
make-synonym-stream
make-two-way-stream
makunbound
map
mapc
mapcan
mapcar
mapcon
maphash
map-into
mapl
maplist
mask-field
max
member
member-if
member-if-not
merge
merge-pathnames
method
method-combination
method-combination-error
method-qualifiers
min
minusp
mismatch
mod
most-negative-double-float
most-negative-fixnum
most-negative-long-float
most-negative-short-float
most-negative-single-float
most-positive-double-float
most-positive-fixnum
most-positive-long-float
most-positive-short-float
most-positive-single-float
muffle-warning
multiple-value-bind
multiple-value-call
multiple-value-list
multiple-value-prog1
multiple-value-setq
multiple-values-limit
name-char
namestring
nbutlast
nconc
next-method-p
nil
nintersection
ninth
no-applicable-method
no-next-method
not
notany
notevery
notinline
nreconc
nreverse
nset-difference
nset-exclusive-or
nstring-capitalize
nstring-downcase
nstring-upcase
nsublis
nsubst
nsubst-if
nsubst-if-not
nsubstitute
nsubstitute-if
nsubstitute-if-not
nth
nthcdr
nth-value
null
number
numberp
numerator
nunion
oddp
open
open-stream-p
optimize
or
otherwise
output-stream-p
package
package-error
package-error-package
package-name
package-nicknames
packagep
package-shadowing-symbols
package-used-by-list
package-use-list
pairlis
parse-error
parse-integer
parse-namestring
pathname
pathname-device
pathname-directory
pathname-host
pathname-match-p
pathname-name
pathnamep
pathname-type
pathname-version
peek-char
phase
pi
plusp
pop
position
position-if
position-if-not
pprint
pprint-dispatch
pprint-exit-if-list-exhausted
pprint-fill
pprint-indent
pprint-linear
pprint-logical-block
pprint-newline
pprint-pop
pprint-tab
pprint-tabular
prin1
prin1-to-string
princ
princ-to-string
print-not-readable
print-not-readable-object
print-object
print-unreadable-object
probe-file
proclaim
prog
prog*
prog1
prog2
progn
program-error
progv
provide
psetf
psetq
push
pushnew
quote
random
random-state
random-state-p
rassoc
rassoc-if
rassoc-if-not
ratio
rational
rationalize
rationalp
read
read-byte
read-char
read-char-no-hang
read-delimited-list
reader-error
read-from-string
read-line
read-preserving-whitespace
read-sequence
readtable
readtable-case
readtablep
real
realp
realpart
reduce
reinitialize-instance
rem
remf
remhash
remove
remove-duplicates
remove-if
remove-if-not
remove-method
remprop
rename-file
rename-package
replace
require
rest
restart
restart-bind
restart-case
restart-name
return
return-from
revappend
reverse
room
rotatef
round
row-major-aref
rplaca
rplacd
safety
satisfies
sbit
scale-float
schar
search
second
sequence
serious-condition
set
set-difference
set-dispatch-macro-character
set-exclusive-or
setf
set-macro-character
set-pprint-dispatch
setq
set-syntax-from-char
seventh
shadow
shadowing-import
shared-initialize
shiftf
short-float
short-float-epsilon
short-float-negative-epsilon
short-site-name
signal
signed-byte
signum
simple-array
simple-base-string
simple-bit-vector
simple-bit-vector-p
simple-condition
simple-condition-format-arguments
simple-condition-format-control
simple-error
simple-string
simple-string-p
simple-type-error
simple-vector
simple-vector-p
simple-warning
sin
single-float
single-float-epsilon
single-float-negative-epsilon
sinh
sixth
sleep
slot-boundp
slot-exists-p
slot-makunbound
slot-missing
slot-unbound
slot-value
software-type
software-version
some
sort
space
special
special-operator-p
speed
sqrt
stable-sort
standard
standard-char
standard-char-p
standard-class
standard-generic-function
standard-method
standard-object
step
storage-condition
store-value
stream
stream-element-type
stream-error
stream-error-stream
stream-external-format
streamp
string
string/=
string<
string<=
string=
string>
string>=
string-capitalize
string-downcase
string-equal
string-greaterp
string-left-trim
string-lessp
string-not-equal
string-not-greaterp
string-not-lessp
stringp
string-right-trim
string-stream
string-trim
string-upcase
structure
structure-class
structure-object
style-warning
sublis
subseq
subsetp
subst
subst-if
subst-if-not
substitute
substitute-if
substitute-if-not
subtypep
svref
sxhash
symbol
symbol-function
symbol-macrolet
symbol-name
symbolp
symbol-package
symbol-plist
symbol-value
synonym-stream
synonym-stream-symbol
t
tagbody
tailp
tan
tanh
tenth
terpri
the
third
throw
time
trace
translate-logical-pathname
translate-pathname
tree-equal
truename
truncate
two-way-stream
two-way-stream-input-stream
two-way-stream-output-stream
type
typecase
type-error
type-error-datum
type-error-expected-type
type-of
typep
unbound-slot
unbound-slot-instance
unbound-variable
undefined-function
unexport
unintern
union
unless
unread-char
unsigned-byte
untrace
unuse-package
unwind-protect
update-instance-for-different-class
update-instance-for-redefined-class
upgraded-array-element-type
upgraded-complex-part-type
upper-case-p
use-package
user-homedir-pathname
use-value
values
values-list
variable
vector
vectorp
vector-pop
vector-push
vector-push-extend
warn
warning
when
wild-pathname-p
with-accessors
with-compilation-unit
with-condition-restarts
with-hash-table-iterator
with-input-from-string
with-open-file
with-open-stream
with-output-to-string
with-package-iterator
with-simple-restart
with-slots
with-standard-io-syntax
write
write-byte
write-char
write-line
write-sequence
write-string
write-to-string
yes-or-no-p
y-or-n-p
zerop
冒号 : 开头的符号是自解析符号的一种,一般指 关键字keyword 符号.
autolisp 为了易用性,封印了很多 lisp 高级特性。 本帖最后由 自贡黄明儒 于 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
啊这,我是第一,下载来学习学习 谢谢猫老师,感谢分享。
谢谢猫老师,感谢分享。 :lol强 6666666666 猫老师太强了,谢谢分享 给力,来看看是什么东东 感谢猫老师,谢谢分享 :D感谢猫老师