str-split 函数有什么作用?



(str-split(函数在此构建中做什么 https://sourceforge.net/p/clipsrules/code/HEAD/tree/branches/63x/core/附言我知道(字符串拆分(函数在其他语言中做什么,比如C++,C#,Java,Python。但在这里,我无法理解。莱利先生,都希望你(((

(deffunction MAIN::str-split (?separator ?str)
(bind $?result (create$))
(bind ?index 1)
(while (> (str-length ?str) 0)
(bind ?index (str-index ?separator ?str))
(if (neq ?index FALSE) 
then
(bind ?temp_string (sub-string 1 (- ?index 1) ?str))
(if (neq ?temp_string "") 
then
(bind $?result (insert$ $?result (+ (length$ $?result) 1)
(create$ ?temp_string)))
)
(bind ?str (sub-string (+ ?index 1) (str-length ?str) ?str))
else
(bind $?result (insert$ $?result (+ (length$ $?result) 1) (create$ ?str)))
(return $?result)
)
)
(return $?result)
)

最新更新