From ed5640d8b587fbcfed7dd7967f3de04b37a76f26 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:06:44 +0200 Subject: Adding upstream version 4:7.4.7. Signed-off-by: Daniel Baumann --- helpcontent2/source/text/sbasic/shared/replace.xhp | 62 ++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 helpcontent2/source/text/sbasic/shared/replace.xhp (limited to 'helpcontent2/source/text/sbasic/shared/replace.xhp') diff --git a/helpcontent2/source/text/sbasic/shared/replace.xhp b/helpcontent2/source/text/sbasic/shared/replace.xhp new file mode 100644 index 000000000..091a2f082 --- /dev/null +++ b/helpcontent2/source/text/sbasic/shared/replace.xhp @@ -0,0 +1,62 @@ + + + + + + + Replace Function + /text/sbasic/shared/replace.xhp + + + +
+ + Replace function + +

Replace Function

+ Replaces some string by another. +
+ + + + Replace (Expression As String, Find As String, Replace As String [, Start = 1 [, Count = -1 [, Compare = True]]]) As String + + + + String + + + Expression: Any string expression that you want to modify. + Find: Any string expression that shall be searched for. + Replace: Any string expression that shall replace the found search string. + Start: Optional numeric expression that indicates the character position where the search starts and also the start of the substring to be returned. + Count: Optional maximum number of times the replace shall be performed. When set to -1, all possible replacements are performed. + Compare: Optional boolean expression that defines the type of comparison. The value of this parameter can be True or False. The default value of True specifies a text comparison that is not case-sensitive. The value of False specifies a binary comparison that is case-sensitive. You can as well use 0 instead of False or 1 instead of True. + + + + + + + MsgBox Replace ("aBbcnnbnn", "b", "$", 1, 1, False) 'returns "aB$cnnbnn" + REM meaning: "b" should be replaced, but + REM * only when lowercase (compare=False), hence second occurrence of "b" + REM * only first (respecting case) occurrence (count=1) + MsgBox Replace ("ABCDEFGHI", "E", "*", 4) + REM returns D*FGHI because the search starts at position 4, which is also the start of the returned string. + MsgBox Replace("aBbcnnbnn", "b", "$£", compare:=False) 'returns "aB$£cnn$£nn" + REM Replace all (count = -1) "b" with "$£" respecting casing (compare=False) starting from first letter (start=1) + +
+ + +
+ +
-- cgit v1.2.3