diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
commit | 267c6f2ac71f92999e969232431ba04678e7437e (patch) | |
tree | 358c9467650e1d0a1d7227a21dac2e3d08b622b2 /helpcontent2/source/text/sbasic/shared/replace.xhp | |
parent | Initial commit. (diff) | |
download | libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.tar.xz libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.zip |
Adding upstream version 4:24.2.0.upstream/4%24.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'helpcontent2/source/text/sbasic/shared/replace.xhp')
-rw-r--r-- | helpcontent2/source/text/sbasic/shared/replace.xhp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/helpcontent2/source/text/sbasic/shared/replace.xhp b/helpcontent2/source/text/sbasic/shared/replace.xhp new file mode 100644 index 0000000000..b6efd98a1c --- /dev/null +++ b/helpcontent2/source/text/sbasic/shared/replace.xhp @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="UTF-8"?> +<helpdocument version="1.0"> + <!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + --> + + <meta> + <topic id="sbasicsharedreplace" indexer="include" status="PUBLISH"> + <title id="tit" xml-lang="en-US">Replace Function</title> + <filename>/text/sbasic/shared/replace.xhp</filename> + </topic> + </meta> + <body> + <section id="replace"> + <bookmark xml-lang="en-US" branch="index" id="bm_id721552551162491"> + <bookmark_value>Replace function</bookmark_value> + </bookmark> + <h1 id="hd_id781552551013521"><link href="text/sbasic/shared/replace.xhp">Replace Function</link></h1> + <paragraph id="par_id291552551013522" role="paragraph">Replaces some string by another.</paragraph> + </section> + + <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/> + <bascode> + <paragraph role="bascode" localize="false" id="bas_id51623159758550">Replace (Expression As String, Find As String, Replace As String [, Start = 1 [, Count = -1 [, Compare = True]]]) As String</paragraph> + </bascode> + <embed href="text/sbasic/shared/01020300.xhp#kwargs"/> + <embed href="text/sbasic/shared/00000003.xhp#functvalue"/> + <paragraph role="paragraph" id="par_id911552552252024">String</paragraph> + + <embed href="text/sbasic/shared/00000003.xhp#functparameters"/> + <paragraph role="paragraph" id="par_id721552552263062"><emph>Expression:</emph> Any string expression that you want to modify.</paragraph> + <paragraph role="paragraph" id="par_id901552552269836"><emph>Find:</emph> Any string expression that shall be searched for.</paragraph> + <paragraph role="paragraph" id="par_id791552552275383"><emph>Replace:</emph> Any string expression that shall replace the found search string.</paragraph> + <paragraph role="paragraph" id="par_id111552552283060"><emph>Start:</emph> Optional numeric expression that indicates the character position where the search starts and also the start of the substring to be returned.</paragraph> + <paragraph role="paragraph" id="par_id921552552289833"><emph>Count:</emph> Optional maximum number of times the replace shall be performed. When set to -1, all possible replacements are performed.</paragraph> + <paragraph role="paragraph" id="par_id891552552302894"><emph>Compare:</emph> Optional boolean expression that defines the type of comparison. The value of this parameter can be <literal>True</literal> or <literal>False</literal>. The default value of <literal>True</literal> specifies a text comparison that is not case-sensitive. The value of <literal>False</literal> specifies a binary comparison that is case-sensitive. You can as well use 0 instead of <literal>False</literal> or 1 instead of <literal>True</literal>.</paragraph> + + <embed href="text/sbasic/shared/00000003.xhp#errorcode"/> + <embed href="text/sbasic/shared/00000003.xhp#err5"/> + <embed href="text/sbasic/shared/00000003.xhp#functexample"/> + + <bascode> + <paragraph role="bascode" id="par_id991552552420717">MsgBox Replace ("aBbcnnbnn", "b", "$", 1, 1, False) 'returns "aB$cnnbnn"</paragraph> + <paragraph role="bascode" id="par_id321552552440672" xml-lang="en-US">REM meaning: "b" should be replaced, but</paragraph> + <paragraph role="bascode" id="par_id571552552467647" xml-lang="en-US">REM * only when lowercase (compare=False), hence second occurrence of "b"</paragraph> + <paragraph role="bascode" id="par_id71552552474769" xml-lang="en-US">REM * only first (respecting case) occurrence (count=1)</paragraph> + <paragraph role="bascode" id="par_id501587778372566" localize="false">MsgBox Replace ("ABCDEFGHI", "E", "*", 4)</paragraph> + <paragraph role="bascode" id="par_id861587778446685" xml-lang="en-US">REM returns D*FGHI because the search starts at position 4, which is also the start of the returned string.</paragraph> + <paragraph role="bascode" id="bas_id491622734884707" xml-lang="en-US">MsgBox Replace("aBbcnnbnn", "b", "$£", compare:=False) 'returns "aB$£cnn$£nn"</paragraph> + <paragraph role="bascode" id="bas_id341622734993202" xml-lang="en-US">REM Replace all (count = -1) "b" with "$£" respecting casing (compare=False) starting from first letter (start=1) </paragraph> + </bascode> + <section id="relatedtopics"> + <paragraph role="paragraph" id="par_id161599082457466" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#stringfunctions"/></paragraph> + <paragraph role="paragraph" id="par_id361623159933508" localize="false"><embedvar href="text/sbasic/shared/03/sf_string.xhp#StringService"/></paragraph> + </section> +</body> +</helpdocument> |