of matching @var{regexp} against a substring of @var{string}.
@end defun
-@defun replace-in-string fromstring tostring instring
+@defun string-replace fromstring tostring instring
This function copies @var{instring} and replaces any occurrences of
@var{fromstring} with @var{tostring}.
@end defun
been added, and takes a callback to handle the return status.
+++
-*** New function 'replace-in-string'.
+*** New function 'string-replace'.
This function works along the line of 'replace-regexp-in-string', but
matching on strings instead of regexps, and does not change the global
match state.
,@mode-line-position--column-line-properties))
(10
(:propertize
- (:eval (replace-in-string
+ (:eval (string-replace
"%c" "%C" (car mode-line-position-column-line-format)))
,@mode-line-position--column-line-properties)))
(6
(,@mode-line-position--column-line-properties)))
(6
(:propertize
- (:eval (replace-in-string
+ (:eval (string-replace
"%c" "%C" (car mode-line-position-column-format)))
,@mode-line-position--column-line-properties))))))
"Mode line construct for displaying the position in the buffer.
(should-error (ignore-error foo
(read ""))))
-(ert-deftest replace-in-string ()
- (should (equal (replace-in-string "foo" "bar" "zot")
+(ert-deftest string-replace ()
+ (should (equal (string-replace "foo" "bar" "zot")
"zot"))
- (should (equal (replace-in-string "foo" "bar" "foozot")
+ (should (equal (string-replace "foo" "bar" "foozot")
"barzot"))
- (should (equal (replace-in-string "foo" "bar" "barfoozot")
+ (should (equal (string-replace "foo" "bar" "barfoozot")
"barbarzot"))
- (should (equal (replace-in-string "zot" "bar" "barfoozot")
+ (should (equal (string-replace "zot" "bar" "barfoozot")
"barfoobar"))
- (should (equal (replace-in-string "z" "bar" "barfoozot")
+ (should (equal (string-replace "z" "bar" "barfoozot")
"barfoobarot"))
- (should (equal (replace-in-string "zot" "bar" "zat")
+ (should (equal (string-replace "zot" "bar" "zat")
"zat"))
- (should (equal (replace-in-string "azot" "bar" "zat")
+ (should (equal (string-replace "azot" "bar" "zat")
"zat"))
- (should (equal (replace-in-string "azot" "bar" "azot")
+ (should (equal (string-replace "azot" "bar" "azot")
"bar"))
- (should (equal (replace-in-string "azot" "bar" "foozotbar")
+ (should (equal (string-replace "azot" "bar" "foozotbar")
"foozotbar"))
- (should (equal (replace-in-string "\377" "x" "a\377b")
+ (should (equal (string-replace "\377" "x" "a\377b")
"axb"))
- (should (equal (replace-in-string "\377" "x" "a\377ø")
+ (should (equal (string-replace "\377" "x" "a\377ø")
"axø"))
- (should-error (replace-in-string "" "x" "abc")))
+ (should-error (string-replace "" "x" "abc")))
(provide 'subr-tests)
;;; subr-tests.el ends here