From c83106ee38048acbe737ef112e8d51c9b5bd42d7 Mon Sep 17 00:00:00 2001 From: Tristan Partin Date: Sun, 7 Mar 2021 22:59:21 -0600 Subject: Add str.replace() method --- docs/markdown/snippets/string_replace.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 docs/markdown/snippets/string_replace.md (limited to 'docs/markdown/snippets') diff --git a/docs/markdown/snippets/string_replace.md b/docs/markdown/snippets/string_replace.md new file mode 100644 index 0000000..e88179d --- /dev/null +++ b/docs/markdown/snippets/string_replace.md @@ -0,0 +1,10 @@ +## String `.replace()` + +String objects now have a method called replace for replacing all instances of a +substring in a string with another. + +```meson +s = 'aaabbb' +s = s.replace('aaa', 'bbb') +# 's' is now 'bbbbbb' +``` -- cgit v1.1