diff options
Diffstat (limited to 'helpcontent2/source/text/sbasic/shared/03120314.xhp')
-rw-r--r-- | helpcontent2/source/text/sbasic/shared/03120314.xhp | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/helpcontent2/source/text/sbasic/shared/03120314.xhp b/helpcontent2/source/text/sbasic/shared/03120314.xhp new file mode 100644 index 000000000..aae47d81c --- /dev/null +++ b/helpcontent2/source/text/sbasic/shared/03120314.xhp @@ -0,0 +1,101 @@ +<?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/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . +--> + +<meta> + <topic id="textsbasicshared03120314xml" indexer="include" status="PUBLISH"> + <title id="tit" xml-lang="en-US">Split Function</title> + <filename>/text/sbasic/shared/03120314.xhp</filename> + </topic> +</meta> + +<body> + + +<section id="split"> +<bookmark xml-lang="en-US" branch="index" id="bm_id3156027"> + <bookmark_value>Split function</bookmark_value> +</bookmark> + + +<paragraph id="hd_id3156027" role="heading" level="1" xml-lang="en-US"><link href="text/sbasic/shared/03120314.xhp" name="Split Function">Split Function</link></paragraph> +<paragraph id="par_id3155805" role="paragraph" xml-lang="en-US">Returns an array of substrings from a string expression.</paragraph> +</section> + +<paragraph id="hd_id3149177" role="heading" level="2" xml-lang="en-US">Syntax:</paragraph> +<bascode> +<paragraph id="par_id3153824" role="bascode" xml-lang="en-US">Split (Text As String, delimiter, number)</paragraph> +</bascode> + +<paragraph id="hd_id3149763" role="heading" level="2" xml-lang="en-US">Return value:</paragraph> +<paragraph id="par_id3154285" role="paragraph" xml-lang="en-US">String</paragraph> + +<paragraph id="hd_id3145315" role="heading" level="2" xml-lang="en-US">Parameters:</paragraph> +<paragraph id="par_id3156023" role="paragraph" xml-lang="en-US"> <emph>Text:</emph> Any string expression.</paragraph> +<paragraph id="par_id3147560" role="paragraph" xml-lang="en-US"> <emph>delimiter (optional):</emph> A string of one or more characters length that is used to delimit the Text. The default is the space character.</paragraph> +<paragraph id="par_id3145069" role="paragraph" xml-lang="en-US"> <emph>number (optional):</emph> The number of substrings that you want to return.</paragraph> + +<paragraph id="hd_id3150398" role="heading" level="2" xml-lang="en-US">Example:</paragraph> + +<section id="splitjoinex"> +<bascode> +<paragraph id="par_idm1341285008" role="bascode" localize="false" xml-lang="en-US">Dim a(3)</paragraph> +<paragraph id="par_idm1341283776" role="bascode" localize="false" xml-lang="en-US">Sub main()</paragraph> +<paragraph id="par_idm1341282544" role="bascode" localize="false" xml-lang="en-US"> a(0) = "ABCDE"</paragraph> +<paragraph id="par_idm1341281312" role="bascode" localize="false" xml-lang="en-US"> a(1) = 42</paragraph> +<paragraph id="par_idm1341280080" role="bascode" localize="false" xml-lang="en-US"> a(2) = "MN"</paragraph> +<paragraph id="par_idm1341278848" role="bascode" localize="false" xml-lang="en-US"> a(3) = "X Y Z"</paragraph> +<paragraph id="par_idm1341277616" role="bascode" localize="false" xml-lang="en-US"> JStr = Join1()</paragraph> +<paragraph id="par_idm1341276384" role="bascode" localize="false" xml-lang="en-US"> Call Show(JStr, Split1(JStr))</paragraph> +<paragraph id="par_idm1341275136" role="bascode" localize="false" xml-lang="en-US"> JStr = Join2()</paragraph> +<paragraph id="par_idm1341273904" role="bascode" localize="false" xml-lang="en-US"> Call Show(JStr, Split1(JStr))</paragraph> +<paragraph id="par_idm1341272656" role="bascode" localize="false" xml-lang="en-US"> JStr = Join3()</paragraph> +<paragraph id="par_idm1341271424" role="bascode" localize="false" xml-lang="en-US"> Call Show(JStr, Split1(JStr))</paragraph> +<paragraph id="par_idm1341270176" role="bascode" localize="false" xml-lang="en-US">End Sub</paragraph> +<paragraph id="par_idm1341268944" role="bascode" localize="false" xml-lang="en-US"> </paragraph> +<paragraph id="par_idm1341267696" role="bascode" localize="false" xml-lang="en-US">Function Join1()</paragraph> +<paragraph id="par_idm1341266464" role="bascode" localize="false" xml-lang="en-US"> Join1 = Join(a(), "abc")</paragraph> +<paragraph id="par_idm1341265216" role="bascode" localize="false" xml-lang="en-US">End Function</paragraph> +<paragraph id="par_idm1341263984" role="bascode" localize="false" xml-lang="en-US"> </paragraph> +<paragraph id="par_idm1341262784" role="bascode" localize="false" xml-lang="en-US">Function Join2()</paragraph> +<paragraph id="par_idm1341261552" role="bascode" localize="false" xml-lang="en-US"> Join2 = Join(a(), ",")</paragraph> +<paragraph id="par_idm1341260304" role="bascode" localize="false" xml-lang="en-US">End Function</paragraph> +<paragraph id="par_idm1341259072" role="bascode" localize="false" xml-lang="en-US"> </paragraph> +<paragraph id="par_idm1341257872" role="bascode" localize="false" xml-lang="en-US">Function Join3()</paragraph> +<paragraph id="par_idm1341256640" role="bascode" localize="false" xml-lang="en-US"> Join3 = Join(a())</paragraph> +<paragraph id="par_idm1341255408" role="bascode" localize="false" xml-lang="en-US">End Function</paragraph> +<paragraph id="par_idm1341254176" role="bascode" localize="false" xml-lang="en-US"> </paragraph> +<paragraph id="par_idm1341252976" role="bascode" localize="false" xml-lang="en-US">Function Split1(aStr)</paragraph> +<paragraph id="par_idm1341251744" role="bascode" localize="false" xml-lang="en-US"> Split1 = Split(aStr, "D")</paragraph> +<paragraph id="par_idm1341250496" role="bascode" localize="false" xml-lang="en-US">End Function</paragraph> +<paragraph id="par_idm1341249264" role="bascode" localize="false" xml-lang="en-US"> </paragraph> +<paragraph id="par_idm1341248064" role="bascode" localize="false" xml-lang="en-US">Sub Show(JoinStr, TheArray)</paragraph> +<paragraph id="par_idm1341246816" role="bascode" localize="false" xml-lang="en-US"> l = LBound(TheArray)</paragraph> +<paragraph id="par_idm1341245568" role="bascode" localize="false" xml-lang="en-US"> u = UBound(TheArray)</paragraph> +<paragraph id="par_idm1341244320" role="bascode" localize="false" xml-lang="en-US"> total$ = "=============================" + Chr$(13) + JoinStr + Chr$(13) + Chr$(13)</paragraph> +<paragraph id="par_idm1341243024" role="bascode" localize="false" xml-lang="en-US"> For i = l To u</paragraph> +<paragraph id="par_idm1341241792" role="bascode" localize="false" xml-lang="en-US"> total$ = total$ + TheArray(i) + Str(Len(TheArray(i))) + Chr$(13)</paragraph> +<paragraph id="par_idm1341240496" role="bascode" localize="false" xml-lang="en-US"> Next i</paragraph> +<paragraph id="par_idm1341239264" role="bascode" localize="false" xml-lang="en-US"> MsgBox total$</paragraph> +<paragraph id="par_idm1341238032" role="bascode" localize="false" xml-lang="en-US">End Sub</paragraph> +</bascode> +</section> +</body> + +</helpdocument>
\ No newline at end of file |