std-strchg, std-string-subst | ![]() |
(std-strchg <str> <old> <new>)
(std-string-subst <new> <old> <str>) ; same but reverse argument order
Both are a simple string search and replace function. The argument ordering in STD-STRCHG
matches the <what> <how> <new> system used in objects, STD-STRING-SUBST
has the same order as subst.
It works case-sensitively and does not expand regular expresssions. If old is an empty string than the whole string is replaced by new.
STD-STRCHG
replaces ALL occurances, STD-STRING-SUBST
only the FIRST occurance of the substring in the string.
Note:
This is because the (in R14 undocumented) Visual LISP function VL-STRING-SUBST
replaces only the first instance of the found substring.
(std-strchg "test" "s" "S") => "teSt" (std-strchg "test" "" "new") => "new" (std-string-subst "new" "old" "old-test-old") => "new-test-old"
str: a string.
old: a string.
new: a string.
A string.
None.
(std-require 'STDSTR)
Defined in STDSTR