- ;|字符串替换-------------------------------无痕.2004.2
- (xsubstr " " "-" "32-33-0.01-哈哈") -> "32 33 0.01 哈哈"
- (xsubstr " - " "-" "32-33-0.01-哈哈") -> "32 - 33 - 0.01 - 哈哈"
- (read (strcat "(" (xsubstr " " "-" "32-33-0.01-哈哈") ")")) -> (32 33 0.01 哈哈)
- (read (strcat "("" (xsubstr "" "" "-" "32-33-0.01-哈哈") "")")) -> ("32" "33" "0.01" "哈哈")
- (read (strcat "("" (xsubstr """-""" "-" "32-33-0.01-哈哈") "")")) -> ("32" "-" "33" "-" "0.01" "-" "哈哈")
- |;
- (defun xsubstr (n$ o$ str / n)
- (setq n 0)
- (while (setq n (vl-string-search o$ str n))
- (setq str (vl-string-subst n$ o$ str n))
- (setq n (+ n (strlen n$)))
- )str
- )
|