0 Members and 1 Guest are viewing this topic.
ronjonp,I find typing CT works alot faster. CT is automatically loaded. I don't have to load CT every time. I'm old school, lol. Also, this CT routine works on MTEXT. I just like it a lot better. I'm just curious why it isn't working on that particular instance.Thank you,David
ronjonp,Thank you very much for your efforts. I tried it but I get a spinning windows circle after I type in new text, waiting for it to change. Oh well, don't worry about it but thank you very much for replying.David
* RING (asterisk space)trying to change it to *(asterisk without the space)That's when I get the windows wheel spinning
This is very strange to me.If I type in to change * R TO R, it worksIf i type * (space) to *(no space) it doesn't change it.But, I will have to say your code is a lot cleaner and shorter than mine. I love it!Thank you much,David
See gif attached.
Thank you very much for your personal time on this. I appreciate you.David
; (String_Subst "aabbaacc" "aa" "xx") => "xxbbxxcc"; (String_Subst "aabbaacc" "aa" "xxaa") => "xxaabbxxaacc"(defun String_Subst (str old new / idx) (setq idx 0) (while (setq idx (vl-string-search old str idx)) (setq str (vl-string-subst new old str idx)) (setq idx (+ idx (strlen new))) ) str)
@ronjonp:Indeed we have discussed string substitution code before. Problems can occur if the new sub-string contains the old sub-string. Your last version of c:CT will catch some cases but not "apple" => "more apples".I would use something like this:Code: [Select]; (String_Subst "aabbaacc" "aa" "xx") => "xxbbxxcc"; (String_Subst "aabbaacc" "aa" "xxaa") => "xxaabbxxaacc"(defun String_Subst (str old new / idx) (setq idx 0) (while (setq idx (vl-string-search old str idx)) (setq str (vl-string-subst new old str idx)) (setq idx (+ idx (strlen new))) ) str)