原程序:(tihuanzifu "1222222" "1" "11")
返回: "11111111222222",显然不对,我帮你修改了一下:
- ;(tihuanzifu "1234567890423456447" "456" "bb") ==> "123bb7890423bb447".
- ;(tihuanzifu "1221221" "1" "11") ==> "1122112211"
- ;(tihuanzifu "221122" "1" "11") ==> "22111122"
- ;(tihuanzifu "212121" "1" "11") ==> "211211211"
- (defun tihuanzifu (zfc bzfc wzfc / cnt)
- (setq cnt 0)
- (while (setq cnt (vl-string-search bzfc zfc cnt))
- (setq zfc (vl-string-subst wzfc bzfc zfc cnt))
- (setq cnt (+ cnt (strlen wzfc)))
- )
- zfc)
|