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/Syntax.md | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'docs/markdown/Syntax.md') diff --git a/docs/markdown/Syntax.md b/docs/markdown/Syntax.md index 30682bd60..557985567 100644 --- a/docs/markdown/Syntax.md +++ b/docs/markdown/Syntax.md @@ -186,6 +186,17 @@ As can be seen, the formatting works by replacing placeholders of type Strings also support a number of other methods that return transformed copies. +#### .replace() + +Since 0.58.0, you can replace a substring from a string. + +```meson +# Replaces all instances of one substring with another +s = 'semicolons;as;separators' +s = s.replace('as', 'are') +# 's' now has the value of 'semicolons;are;separators' +``` + #### .strip() ```meson -- cgit v1.2.3