Skip to content

文本查找索引

类型 ​

meta-lisp
(-> 文本型 文本型 整数型)

描述 ​

查找片段在文本中第一次出现的位置。不存在时返回 -1。

例子 ​

meta-lisp
(文本查找索引 "hello" "ll")  ;; => 2
(文本查找索引 "hello" "x")   ;; => -1
(文本查找索引 "hello" "")    ;; => 0