aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Innes1999-01-17 18:55:53 +0000
committerAndrew Innes1999-01-17 18:55:53 +0000
commit1ccaea525e5580acbd88624ecc9554d2a6b7d641 (patch)
tree34fde640048c0d7b1680db03c87f8b5b8babc853
parent795537a21c2ad08be72c571a9e3756dec226e90d (diff)
downloademacs-1ccaea525e5580acbd88624ecc9554d2a6b7d641.tar.gz
emacs-1ccaea525e5580acbd88624ecc9554d2a6b7d641.zip
(subst-char-in-string): New function.
-rw-r--r--lisp/subr.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index cdbb06b4b5d..e4c2c1e6978 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1092,6 +1092,17 @@ at the end of STRING, we don't include a null substring for that."
1092 (cons (substring string start) 1092 (cons (substring string start)
1093 list))) 1093 list)))
1094 (nreverse list))) 1094 (nreverse list)))
1095
1096(defun subst-char-in-string (fromchar tochar string &optional inplace)
1097 "Replace FROMCHAR with TOCHAR in STRING each time it occurs.
1098Unless optional argument INPLACE is non-nil, return a new string."
1099 (let ((i (length string))
1100 (newstr (if inplace string (copy-sequence string))))
1101 (while (> i 0)
1102 (setq i (1- i))
1103 (if (eq (aref newstr i) fromchar)
1104 (aset newstr i tochar)))
1105 newstr))
1095 1106
1096(defun shell-quote-argument (argument) 1107(defun shell-quote-argument (argument)
1097 "Quote an argument for passing as argument to an inferior shell." 1108 "Quote an argument for passing as argument to an inferior shell."