本帖最后由 vitalgg 于 2023-5-18 21:16 编辑
- (defun sum-in-2str (str pre post)
- "对字符串str内 pre 和 post 之的数字求和"
- "number"
- (setq lst (string:auto-split str))
- (setq pre-str (car lst))
- (setq sum 0)
- (while (setq lst (cdr lst))
-
- (if(and
- (apply 'and (mapcar '= (reverse (string:s2l-ansi pre-str))
- (reverse (string:s2l-ansi pre))))
- (string:numberp (car lst))
- (apply 'and (mapcar '= (string:s2l-ansi (cadr lst))
- (string:s2l-ansi post))))
- (setq sum (+ sum (read (car lst)))))
- (setq pre-str (car lst)))
- sum)
|