[Libreoffice-commits] help.git: source/text
Rafael Lima (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jul 26 09:48:36 UTC 2021
source/text/sbasic/shared/03/avail_release.xhp | 5
source/text/sbasic/shared/03/sf_array.xhp | 1770 ++++++++++++-------------
2 files changed, 916 insertions(+), 859 deletions(-)
New commits:
commit 1cd02ab17dec63054396dfddb675334f2963a533
Author: Rafael Lima <rafael.palma.lima at gmail.com>
AuthorDate: Fri Jul 23 21:27:33 2021 +0200
Commit: Jean-Pierre Ledure <jp at ledure.be>
CommitDate: Mon Jul 26 11:48:14 2021 +0200
Adapt SF_Array to the new method signature notation
This patch updates the syntax and arguments in all methods according to the new notation used in other SF services. It also introduces the ImportFromCSVFile method to Python scripts.
This patch also updates a few examples in Basic.
Change-Id: Ib565f31ad13f5455ff1df260ec60cae5d8848cd9
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/119437
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp at ledure.be>
diff --git a/source/text/sbasic/shared/03/avail_release.xhp b/source/text/sbasic/shared/03/avail_release.xhp
index 0a02b37aa..887351ad8 100644
--- a/source/text/sbasic/shared/03/avail_release.xhp
+++ b/source/text/sbasic/shared/03/avail_release.xhp
@@ -22,6 +22,7 @@
<section id="UnAvailPythonMethod"><note id="not_PycMeth">This method is not available in Python.</note></section>
<section id="UnAvailPythonProperty"><note id="not_PycProp">This property is not available in Python.</note></section>
+ <comment> Tags for LibreOffice 7.2 </comment>
<section id="7.2.service">
<note id="par_id651551701041690">This service is available from %PRODUCTNAME 7.2 onwards.</note>
</section>
@@ -40,6 +41,10 @@
<section id="7.2.property">
<note id="par_id201613654395537">This property is available from %PRODUCTNAME 7.2 onwards.</note>
</section>
+ <comment> Tags for LibreOffice 7.3 </comment>
+ <section id="7.3.method">
+ <note id="par_id291613654389792">This method is available from %PRODUCTNAME 7.3 onwards.</note>
+ </section>
</body>
</helpdocument>
\ No newline at end of file
diff --git a/source/text/sbasic/shared/03/sf_array.xhp b/source/text/sbasic/shared/03/sf_array.xhp
index d4b65fb01..8307754d8 100644
--- a/source/text/sbasic/shared/03/sf_array.xhp
+++ b/source/text/sbasic/shared/03/sf_array.xhp
@@ -17,899 +17,951 @@
<body>
<section id="abstract">
- <bookmark xml-lang="en-US" branch="index" id="bm_id281613039222756">
- <bookmark_value>Array service</bookmark_value>
- </bookmark>
-
- <h1 id="bm_id781582391760253" xml-lang="en-US"><variable id="ArrayService"><link href="text/sbasic/shared/03/sf_array.xhp" name="ScriptForge.Array Service"><literal>ScriptForge</literal>.<literal>Array</literal> service</link></variable></h1>
- <paragraph role="paragraph" id="par_id991582454416549" xml-lang="en-US">Provides a collection of methods for manipulating and transforming arrays of one dimension (vectors) and arrays of two dimensions (matrices). This includes set operations, sorting, importing to and exporting from text files.</paragraph>
- <paragraph role="paragraph" id="par_id681609955015503">Arrays with more than two dimensions cannot be used with the methods in this service, the only exception being the <literal>CountDims</literal> method that accepts Arrays with any number of dimensions.</paragraph>
-</section>
-
- <paragraph role="paragraph" id="par_id651582454426538" xml-lang="en-US">Array items may contain any type of value, including (sub)arrays.</paragraph>
-
- <h2 id="hd_id981586595097630" xml-lang="en-US">Service invocation</h2>
- <paragraph role="paragraph" id="par_id141609955500101">Before using the <literal>Array</literal> service the <literal>ScriptForge</literal> library needs to be loaded using:</paragraph>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id871608192694632">GlobalScope.BasicLibraries.LoadLibrary("ScriptForge")</paragraph>
- </bascode>
- <paragraph role="paragraph" id="par_id461609955633383">Loading the library will create the <literal>SF_Array</literal> object that can be used to call the methods in the <literal>Array</literal> service.</paragraph>
- <paragraph role="paragraph" id="par_id63158659509728" xml-lang="en-US">The following code snippets show the various ways to call methods in the <literal>Array</literal> service (the <literal>Append</literal> method is used as an example):</paragraph>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id311586595097510">SF_Array.Append(...)</paragraph>
- </bascode>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id811586595097328">Dim arr : arr = SF_Array</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id761586595097825">arr.Append(...)</paragraph>
- </bascode>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id821586595097892">Dim arr : arr = CreateScriptService("Array")</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id81586595097173">arr.Append(...)</paragraph>
- </bascode>
- <note id="par_id571609956486468">The <literal>CreateScriptService</literal> method is only available after you have loaded the <literal>ScriptForge</literal> library.</note>
- <table id="tab_id221606235233835">
- <tablerow>
- <tablecell colspan="3"><paragraph id="par_id651606319520519" role="tablehead">Methods</paragraph></tablecell>
- </tablerow>
- <tablerow>
- <tablecell><paragraph id="par_id361606235233835" role="tablecontent" localize="false">
- <link href="text/sbasic/shared/03/sf_array.xhp#Append" name="Append method">Append</link><br/>
- <link href="text/sbasic/shared/03/sf_array.xhp#AppendColumn" name="AppendColumn method">AppendColumn</link><br/>
- <link href="text/sbasic/shared/03/sf_array.xhp#AppendRow" name="AppendRow method">AppendRow</link><br/>
- <link href="text/sbasic/shared/03/sf_array.xhp#Contains" name="Contains method">Contains</link><br/>
- <link href="text/sbasic/shared/03/sf_array.xhp#ConvertToDictionary" name="ConvertToDictionary method">ConvertToDictionary</link><br/>
- <link href="text/sbasic/shared/03/sf_array.xhp#CountDims" name="CountDims method">CountDims</link><br/>
- <link href="text/sbasic/shared/03/sf_array.xhp#Difference" name="Difference method">Difference</link><br/>
- <link href="text/sbasic/shared/03/sf_array.xhp#ExportToTextFile" name="ExportToTextFile method">ExportToTextFile</link><br/>
- <link href="text/sbasic/shared/03/sf_array.xhp#ExtractColumn" name="ExtractColumn">ExtractColumn</link><br/>
- <link href="text/sbasic/shared/03/sf_array.xhp#ExtractRow" name="ExtractRow method">ExtractRow</link><br/>
- </paragraph></tablecell>
- <tablecell><paragraph id="par_id231606235233835" role="tablecontent" localize="false">
- <link href="text/sbasic/shared/03/sf_array.xhp#Flatten" name="Flatten method">Flatten</link><br/>
- <link href="text/sbasic/shared/03/sf_array.xhp#ImportFromCSVFile" name="ImportFromCSVFile method">ImportFromCSVFile</link><br/>
- <link href="text/sbasic/shared/03/sf_array.xhp#IndexOf" name="IndexOf method">IndexOf</link><br/>
- <link href="text/sbasic/shared/03/sf_array.xhp#Insert" name="Insert method">Insert</link><br/>
- <link href="text/sbasic/shared/03/sf_array.xhp#InsertSorted" name="InsertSorted method">InsertSorted</link><br/>
- <link href="text/sbasic/shared/03/sf_array.xhp#Intersection" name="Intersection">Intersection</link><br/>
- <link href="text/sbasic/shared/03/sf_array.xhp#Join2D" name="Join2D method">Join2D</link><br/>
- <link href="text/sbasic/shared/03/sf_array.xhp#Prepend" name="Prepend method">Prepend</link><br/>
- <link href="text/sbasic/shared/03/sf_array.xhp#PrependColumn" name="PrependColumn method">PrependColumn</link><br/>
- <link href="text/sbasic/shared/03/sf_array.xhp#PrependRow" name="PrependRow method">PrependRow</link><br/><br/>
- </paragraph></tablecell>
- <tablecell><paragraph id="par_id831606235233835" role="tablecontent" localize="false">
- <link href="text/sbasic/shared/03/sf_array.xhp#RangeInit" name="RangeInit method">RangeInit</link><br/>
- <link href="text/sbasic/shared/03/sf_array.xhp#Reverse" name="Reverse method">Reverse</link><br/>
- <link href="text/sbasic/shared/03/sf_array.xhp#Shuffle" name="Shuffle method">Shuffle</link><br/>
- <link href="text/sbasic/shared/03/sf_array.xhp#Slice" name="Slice method">Slice</link><br/>
- <link href="text/sbasic/shared/03/sf_array.xhp#Sort" name="Sort method">Sort</link><br/>
- <link href="text/sbasic/shared/03/sf_array.xhp#SortColumns" name="SortColumns method">SortColumns</link><br/>
- <link href="text/sbasic/shared/03/sf_array.xhp#SortRows" name="SortRows method">SortRows</link><br/>
- <link href="text/sbasic/shared/03/sf_array.xhp#Transpose" name="Transpose method">Transpose</link><br/>
- <link href="text/sbasic/shared/03/sf_array.xhp#TrimArray" name="TrimArray method">TrimArray</link><br/>
- <link href="text/sbasic/shared/03/sf_array.xhp#Union" name="Union method">Union</link><br/>
- <link href="text/sbasic/shared/03/sf_array.xhp#Unique" name="Unique method">Unique</link>
- </paragraph></tablecell>
- </tablerow>
- </table>
- <tip id="par_id191582454485250" xml-lang="en-US">The first argument of most methods is the array object to be considered. It is always passed by reference and left unchanged. Methods such as Append, Prepend, etc return a new array object after their execution.</tip>
- <section id="Append">
- <comment> Append -------------------------------------------------------------------------------------------------------------------------- </comment>
- <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id251582548992953">
- <bookmark_value>Array service;Append</bookmark_value>
- </bookmark>
- <h2 id="hd_id151582548992953" localize="false">Append</h2>
- <paragraph role="paragraph" id="par_id931582548992953">Appends the items listed as arguments to the end of the input array.</paragraph>
- <h3 id="hd_id71582548992953" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id681582548992953">SF_Array.Append(Array_1D As Variant, arg0 As Variant, [arg1 As Variant], ...) As Variant</paragraph>
- </bascode>
- <h3 id="hd_id631582548992953" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
- <paragraph role="paragraph" id="par_id471582548992953"><emph>Array_1D</emph> : the pre-existing array, may be empty.</paragraph>
- <paragraph role="paragraph" id="par_id531582548992953"><emph>arg0, ...</emph> : a list of items to append to Array_1D.</paragraph>
- <h3 id="hd_id301582548992954" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id11582548992954">Sub Example_Append()</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id101582548992954">Dim a As Variant</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id561582548992954"> a = SF_Array.Append(Array(1, 2, 3), 4, 5)</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id541582548992954"> ' (1, 2, 3, 4, 5)</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id331582548992954">End Sub</paragraph>
- </bascode>
- </section>
- <section id="AppendColumn">
- <comment> AppendColumn -------------------------------------------------------------------------------------------------------------------------- </comment>
- <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id591582549679172">
- <bookmark_value>Array service;AppendColumn</bookmark_value>
- </bookmark>
- <h2 id="hd_id291582549679173" localize="false">AppendColumn</h2>
- <paragraph role="paragraph" id="par_id241582549679173">Appends a new column to the right side of a two dimensional array. The resulting array has the same lower bounds as the initial two dimensional array.</paragraph>
- <h3 id="hd_id81582549679174" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id901582549679174">SF_Array.AppendColumn(Array_2D As Variant, New_Column As Variant) As Variant</paragraph>
- </bascode>
- <h3 id="hd_id41582549679175" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
- <paragraph role="paragraph" id="par_id461582549679175"><emph>Array_2D</emph> : the pre-existing array, may be empty. If that array has only one dimension, it is considered as the first column of the resulting two-dimensional array.</paragraph>
- <paragraph role="paragraph" id="par_id991582549679175"><emph>New_Column</emph> : a 1-dimensional array with as many items as there are rows in <literal>Array_2D</literal>.</paragraph>
- <h3 id="hd_id961582549679176" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id461582549679176">Sub Example_AppendColumn()</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id341582549679177">Dim a As Variant, b As variant</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id681582549679177"> a = SF_Array.AppendColumn(Array(1, 2, 3), Array(4, 5, 6))</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id151582549679177"> ' ((1, 4), (2, 5), (3, 6))</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id991609959313410"> b = SF_Array.AppendColumn(a, Array(7, 8, 9))</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id681609959354695"> ' ((1, 4, 7), (2, 5, 8), (3, 6, 9))</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id961582550242823"> c = SF_Array.AppendColumn(Array(), Array(1, 2, 3))</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id381582550413514"> ' ∀ i ∈ {0 ≤ i ≤ 2} : b(0, i) ≡ i</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id141582549679178">End Sub</paragraph>
- </bascode>
- </section>
- <section id="AppendRow">
- <comment> AppendRow -------------------------------------------------------------------------------------------------------------------------- </comment>
- <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id451582551311490">
- <bookmark_value>Array service;AppendRow</bookmark_value>
- </bookmark>
- <h2 id="hd_id751582551333335" localize="false">AppendRow</h2>
- <paragraph role="paragraph" id="par_id941582551396374">Append to the bottom of a two dimension array a new row. The resulting array has the same lower bounds as the initial two dimension array.</paragraph>
- <h3 id="hd_id731582551411476" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id721582551425203">SF_Array.AppendRow(Array_2D As Variant, Row As Variant) As Variant</paragraph>
- </bascode>
- <h3 id="hd_id391582551448394" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
- <paragraph role="paragraph" id="par_id631582551461984"><emph>Array_2D</emph> : the pre-existing array, may be empty. If that array has 1 dimension, it is considered as the first row of the resulting 2 dimension array.</paragraph>
- <paragraph role="paragraph" id="par_id101582551483685"><emph>Row</emph> : a 1D array with as many items as there are columns in Array_2D.</paragraph>
- <h3 id="hd_id501582551510428" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id241582551522761">Sub Example_AppendRow()</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id521582551530025">Dim a As Variant, b As variant</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id951582551538465"> a = SF_Array.AppendRow(Array(1, 2, 3), Array(4, 5, 6))</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id521582551545445"> ' ((1, 2, 3), (4, 5, 6))</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id431582551552206"> b = SF_Array..AppendRow(Array(), Array(1, 2, 3))</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id851582551572028"> ' ∀ i ∈ {0 ≤ i ≤ 2} : b(i, 0) ≡ i</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id371582551580870">End Sub</paragraph>
- </bascode>
- </section>
- <section id="Contains">
- <comment> Contains -------------------------------------------------------------------------------------------------------------------------- </comment>
- <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id521582552517869">
- <bookmark_value>Array service;Contains</bookmark_value>
- </bookmark>
- <h2 id="hd_id21582552517870" localize="false">Contains</h2>
- <paragraph role="paragraph" id="par_id391582552517870">Check if a one dimension array contains a certain number, text or date. Text comparison can be case-sensitive or not.
+ <bookmark xml-lang="en-US" branch="index" id="bm_id281613039222756">
+ <bookmark_value>Array service</bookmark_value>
+ </bookmark>
+
+ <h1 id="bm_id781582391760253"><variable id="ArrayService"><link href="text/sbasic/shared/03/sf_array.xhp" name="ScriptForge.Array Service"><literal>ScriptForge</literal>.<literal>Array</literal> service</link></variable></h1>
+ <paragraph role="paragraph" id="par_id991582454416549">Provides a collection of methods for manipulating and transforming arrays of one dimension (vectors) and arrays of two dimensions (matrices). This includes set operations, sorting, importing to and exporting from text files.</paragraph>
+ <paragraph role="paragraph" id="par_id681609955015503">Arrays with more than two dimensions cannot be used with the methods in this service, the only exception being the <literal>CountDims</literal> method that accepts Arrays with any number of dimensions.</paragraph>
+</section>
+
+ <paragraph role="paragraph" id="par_id651582454426538">Array items may contain any type of value, including (sub)arrays.</paragraph>
+
+ <h2 id="hd_id981586595097630">Service invocation</h2>
+ <paragraph role="paragraph" id="par_id141609955500101">Before using the <literal>Array</literal> service the <literal>ScriptForge</literal> library needs to be loaded using:</paragraph>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id871608192694632">GlobalScope.BasicLibraries.loadLibrary("ScriptForge")</paragraph>
+ </bascode>
+ <paragraph role="paragraph" id="par_id461609955633383">Loading the library will create the <literal>SF_Array</literal> object that can be used to call the methods in the <literal>Array</literal> service.</paragraph>
+ <paragraph role="paragraph" id="par_id63158659509728">The following code snippets show the various ways to call methods in the <literal>Array</literal> service (the <literal>Append</literal> method is used as an example):</paragraph>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id211626911224256">Dim arr : arr = Array(1, 2, 3)</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id311586595097510">arr = SF_Array.Append(arr, 4)</paragraph>
+ </bascode>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id211626911224167">Dim arr : arr = Array(1, 2, 3)</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id811586595097328">Dim svc : svc = SF_Array</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id761586595097825">arr = svc.Append(arr, 4)</paragraph>
+ </bascode>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id211626911224417">Dim arr : arr = Array(1, 2, 3)</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id821586595097892">Dim svc : svc = CreateScriptService("Array")</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id81586595097173">arr = svc.Append(arr, 4)</paragraph>
+ </bascode>
+ <warning id="par_id571609956486468">Because Python has built-in list and tuple support, most of the methods in the <literal>Array</literal> service are available for Basic scripts only. The only exception is <literal>ImportFromCSVFile</literal> which is supported in both Basic and Python.</warning>
+ <table id="tab_id221606235233835">
+ <tablerow>
+ <tablecell colspan="3"><paragraph id="par_id651606319520519" role="tablehead">List of Methods in the Array Service</paragraph></tablecell>
+ </tablerow>
+ <tablerow>
+ <tablecell><paragraph id="par_id361606235233835" role="tablecontent" localize="false">
+ <link href="text/sbasic/shared/03/sf_array.xhp#Append" name="Append method">Append</link><br/>
+ <link href="text/sbasic/shared/03/sf_array.xhp#AppendColumn" name="AppendColumn method">AppendColumn</link><br/>
+ <link href="text/sbasic/shared/03/sf_array.xhp#AppendRow" name="AppendRow method">AppendRow</link><br/>
+ <link href="text/sbasic/shared/03/sf_array.xhp#Contains" name="Contains method">Contains</link><br/>
+ <link href="text/sbasic/shared/03/sf_array.xhp#ConvertToDictionary" name="ConvertToDictionary method">ConvertToDictionary</link><br/>
+ <link href="text/sbasic/shared/03/sf_array.xhp#Copy" name="Copy method">Copy</link><br/>
+ <link href="text/sbasic/shared/03/sf_array.xhp#CountDims" name="CountDims method">CountDims</link><br/>
+ <link href="text/sbasic/shared/03/sf_array.xhp#Difference" name="Difference method">Difference</link><br/>
+ <link href="text/sbasic/shared/03/sf_array.xhp#ExportToTextFile" name="ExportToTextFile method">ExportToTextFile</link><br/>
+ <link href="text/sbasic/shared/03/sf_array.xhp#ExtractColumn" name="ExtractColumn">ExtractColumn</link><br/>
+ <link href="text/sbasic/shared/03/sf_array.xhp#ExtractRow" name="ExtractRow method">ExtractRow</link><br/>
+ </paragraph></tablecell>
+ <tablecell><paragraph id="par_id231606235233835" role="tablecontent" localize="false">
+ <link href="text/sbasic/shared/03/sf_array.xhp#Flatten" name="Flatten method">Flatten</link><br/>
+ <link href="text/sbasic/shared/03/sf_array.xhp#ImportFromCSVFile" name="ImportFromCSVFile method">ImportFromCSVFile</link><br/>
+ <link href="text/sbasic/shared/03/sf_array.xhp#IndexOf" name="IndexOf method">IndexOf</link><br/>
+ <link href="text/sbasic/shared/03/sf_array.xhp#Insert" name="Insert method">Insert</link><br/>
+ <link href="text/sbasic/shared/03/sf_array.xhp#InsertSorted" name="InsertSorted method">InsertSorted</link><br/>
+ <link href="text/sbasic/shared/03/sf_array.xhp#Intersection" name="Intersection">Intersection</link><br/>
+ <link href="text/sbasic/shared/03/sf_array.xhp#Join2D" name="Join2D method">Join2D</link><br/>
+ <link href="text/sbasic/shared/03/sf_array.xhp#Prepend" name="Prepend method">Prepend</link><br/>
+ <link href="text/sbasic/shared/03/sf_array.xhp#PrependColumn" name="PrependColumn method">PrependColumn</link><br/>
+ <link href="text/sbasic/shared/03/sf_array.xhp#PrependRow" name="PrependRow method">PrependRow</link><br/>
+ <link href="text/sbasic/shared/03/sf_array.xhp#RangeInit" name="RangeInit method">RangeInit</link><br/>
+ </paragraph></tablecell>
+ <tablecell><paragraph id="par_id831606235233835" role="tablecontent" localize="false">
+ <link href="text/sbasic/shared/03/sf_array.xhp#Reverse" name="Reverse method">Reverse</link><br/>
+ <link href="text/sbasic/shared/03/sf_array.xhp#Shuffle" name="Shuffle method">Shuffle</link><br/>
+ <link href="text/sbasic/shared/03/sf_array.xhp#Slice" name="Slice method">Slice</link><br/>
+ <link href="text/sbasic/shared/03/sf_array.xhp#Sort" name="Sort method">Sort</link><br/>
+ <link href="text/sbasic/shared/03/sf_array.xhp#SortColumns" name="SortColumns method">SortColumns</link><br/>
+ <link href="text/sbasic/shared/03/sf_array.xhp#SortRows" name="SortRows method">SortRows</link><br/>
+ <link href="text/sbasic/shared/03/sf_array.xhp#Transpose" name="Transpose method">Transpose</link><br/>
+ <link href="text/sbasic/shared/03/sf_array.xhp#TrimArray" name="TrimArray method">TrimArray</link><br/>
+ <link href="text/sbasic/shared/03/sf_array.xhp#Union" name="Union method">Union</link><br/>
+ <link href="text/sbasic/shared/03/sf_array.xhp#Unique" name="Unique method">Unique</link><br/><br/>
+ </paragraph></tablecell>
+ </tablerow>
+ </table>
+ <tip id="par_id191582454485250">The first argument of most methods is the array object to be considered. It is always passed by reference and left unchanged. Methods such as Append, Prepend, etc return a new array object after their execution.</tip>
+
+<section id="Append">
+ <comment> Append --------------------------------------------------------------------------------------------- </comment>
+ <bookmark localize="false" branch="index" id="bm_id251582548992953">
+ <bookmark_value>Array service;Append</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id151582548992953" localize="false">Append</h2>
+ <paragraph role="paragraph" id="par_id931582548992953">Appends the items listed as arguments to the end of the input array.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id921626975382809">
+ <input>svc.Append(array_1d: any[0..*], arg0: any, [arg1: any] ...): any[0..*]</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id471582548992953"><emph>array_1d</emph>: The pre-existing array, may be empty.</paragraph>
+ <paragraph role="paragraph" id="par_id531582548992953"><emph>arg0, arg1, ...</emph>: Items that will be appended to <literal>array_1d</literal>.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id101582548992954">Dim a As Variant</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id561582548992954">a = SF_Array.Append(Array(1, 2, 3), 4, 5)</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id541582548992954"> ' (1, 2, 3, 4, 5)</paragraph>
+ </bascode>
+</section>
+
+<section id="AppendColumn">
+ <comment> AppendColumn --------------------------------------------------------------------------------------- </comment>
+ <bookmark localize="false" branch="index" id="bm_id591582549679172">
+ <bookmark_value>Array service;AppendColumn</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id291582549679173" localize="false">AppendColumn</h2>
+ <paragraph role="paragraph" id="par_id241582549679173">Appends a new column to the right side of a two dimensional array. The resulting array has the same lower bounds as the initial two dimensional array.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id231626975799102">
+ <input>svc.AppendColumn(array_2d: any[0..*, 0..*], column: any[0..*]): any[0..*, 0..*]</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id461582549679175"><emph>array_2d</emph>: The pre-existing array, may be empty. If that array has only one dimension, it is considered as the first column of the resulting two-dimensional array.</paragraph>
+ <paragraph role="paragraph" id="par_id991582549679175"><emph>column</emph>: A 1-dimensional array with as many items as there are rows in <literal>array_2d</literal>.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id341582549679177">Dim a As Variant, b As variant</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id681582549679177">a = SF_Array.AppendColumn(Array(1, 2, 3), Array(4, 5, 6))</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id151582549679177"> ' ((1, 4), (2, 5), (3, 6))</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id991609959313410">b = SF_Array.AppendColumn(a, Array(7, 8, 9))</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id681609959354695"> ' ((1, 4, 7), (2, 5, 8), (3, 6, 9))</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id961582550242823">c = SF_Array.AppendColumn(Array(), Array(1, 2, 3))</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id381582550413514"> ' ∀ i ∈ {0 ≤ i ≤ 2} : b(0, i) ≡ i</paragraph>
+ </bascode>
+</section>
+
+<section id="AppendRow">
+ <comment> AppendRow ------------------------------------------------------------------------------------------ </comment>
+ <bookmark localize="false" branch="index" id="bm_id451582551311490">
+ <bookmark_value>Array service;AppendRow</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id751582551333335" localize="false">AppendRow</h2>
+ <paragraph role="paragraph" id="par_id941582551396374">Append to the bottom of a two dimension array a new row. The resulting array has the same lower bounds as the initial two dimension array.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id371626976443125">
+ <input>svc.AppendRow(array_2d: any[0..*, 0..*], row: any[0..*]): any[0..*, 0..*])</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id631582551461984"><emph>array_2d</emph>: The pre-existing array, may be empty. If that array has 1 dimension, it is considered as the first row of the resulting 2 dimension array.</paragraph>
+ <paragraph role="paragraph" id="par_id101582551483685"><emph>row</emph>: A 1-dimensional array with as many items as there are columns in <literal>array_2d</literal>.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id521582551530025">Dim a As Variant, b As variant</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id951582551538465">a = SF_Array.AppendRow(Array(1, 2, 3), Array(4, 5, 6))</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id521582551545445"> ' ((1, 2, 3), (4, 5, 6))</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id431582551552206">b = SF_Array..AppendRow(Array(), Array(1, 2, 3))</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id851582551572028"> ' ∀ i ∈ {0 ≤ i ≤ 2} : b(i, 0) ≡ i</paragraph>
+ </bascode>
+</section>
+
+<section id="Contains">
+ <comment> Contains ------------------------------------------------------------------------------------------- </comment>
+ <bookmark localize="false" branch="index" id="bm_id521582552517869">
+ <bookmark_value>Array service;Contains</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id21582552517870" localize="false">Contains</h2>
+ <paragraph role="paragraph" id="par_id391582552517870">Check if a one dimension array contains a certain number, text or date. Text comparison can be case-sensitive or not.
<br/>Sorted input arrays must be filled homogeneously, meaning all items must be scalars of the same type (<literal>Empty</literal> and <literal>Null</literal> items are forbidden).
<br/>The result of the method is unpredictable when the array is announced as sorted and is in reality not.
<br/>A binary search is done when the array is sorted, otherwise, it is simply scanned from top to bottom and <literal>Empty</literal> and <literal>Null</literal> items are ignored.</paragraph>
- <h3 id="hd_id571582552517870" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id511582552517871">SF_Array.Contains(Array_1D, ToFind As Variant, [CaseSensitive As Boolean], [SortOrder As String]) As Boolean</paragraph>
- </bascode>
- <h3 id="hd_id771582552517871" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
- <paragraph role="paragraph" id="par_id451582552517871"><emph>Array_1D</emph> : the array to scan.</paragraph>
- <paragraph role="paragraph" id="par_id221582552517872"><emph>ToFind</emph> : a number, a date or a string to find.</paragraph>
- <paragraph role="paragraph" id="par_id981582552517872"><emph>CaseSensitive</emph> : Only for string comparisons, default = <literal>False</literal>.</paragraph>
- <paragraph role="paragraph" id="par_id641582553128490"><emph>SortOrder</emph> : "ASC", "DESC" or "" (= not sorted, default)</paragraph>
- <h3 id="hd_id921582552517872" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id641582552517872">Sub Example_Contains()</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id651582552517872">Dim a As Variant</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id111582552517872"> a = SF_Array.Contains(Array("A","B","c","D"), "C", SortOrder := "ASC") ' True</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id681582552517872"> SF_Array.Contains(Array("A","B","c","D"), "C", CaseSensitive := True) ' False</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id91582552517872">End Sub</paragraph>
- </bascode>
- </section>
- <section id="ConvertToDictionary">
- <comment> ConvertToDictionary -------------------------------------------------------------------------------------------------------------------------- </comment>
- <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id441582557214489">
- <bookmark_value>Array service;ConvertToDictionary</bookmark_value>
- </bookmark>
- <h2 id="hd_id541582557214489" localize="false">ConvertToDictionary</h2>
- <paragraph role="paragraph" id="par_id71582557214489">Store the content of a 2-columns array into a <link href="text/sbasic/shared/03/sf_dictionary.xhp" name="dictionary">ScriptForge.Dictionary</link> object.
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id641626976688897">
+ <input>svc.Contains(array_1d: any[0..*], tofind: any, casesensitive: bool = False, sortorder: str = ""): bool</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id451582552517871"><emph>array_1d</emph>: The array to scan.</paragraph>
+ <paragraph role="paragraph" id="par_id221582552517872"><emph>tofind</emph>: A number, a date or a string to find.</paragraph>
+ <paragraph role="paragraph" id="par_id981582552517872"><emph>casesensitive</emph>: Only for string comparisons (Default = <literal>False</literal>).</paragraph>
+ <paragraph role="paragraph" id="par_id641582553128490"><emph>sortorder</emph>: It can be either "ASC", "DESC" or "" (not sorted). The default value is "".</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id651582552517872">Dim a As Variant</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id111582552517872">a = SF_Array.Contains(Array("A","B","c","D"), "C", SortOrder := "ASC") ' True</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id681582552517872">SF_Array.Contains(Array("A","B","c","D"), "C", CaseSensitive := True) ' False</paragraph>
+ </bascode>
+</section>
+
+<section id="ConvertToDictionary">
+ <comment> ConvertToDictionary ------------------------------------------------------------------------------------ </comment>
+ <bookmark localize="false" branch="index" id="bm_id441582557214489">
+ <bookmark_value>Array service;ConvertToDictionary</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id541582557214489" localize="false">ConvertToDictionary</h2>
+ <paragraph role="paragraph" id="par_id71582557214489">Store the content of a 2-columns array into a <link href="text/sbasic/shared/03/sf_dictionary.xhp" name="dictionary">ScriptForge.Dictionary</link> object.
<br/>The key will be extracted from the first column, the item from the second.</paragraph>
- <h3 id="hd_id481582557214489" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id921582557214489">SF_Array.ConvertToDictionary(Array_2D As Variant) As Variant</paragraph>
- </bascode>
- <h3 id="hd_id761582557214489" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
- <paragraph role="paragraph" id="par_id561582557214489"><emph>Array_1D</emph> : the first column must contain exclusively strings with a length > 0, in any order.</paragraph>
- <h3 id="hd_id591582557214490" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id851582557214490">Sub Example_ConvertToDictionary()</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id921582557214490">Dim a As Variant, b As Variant</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id261582557214490"> a = SF_Array.AppendColumn(Array("a", "b", "c"), Array(1, 2, 3))</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id931582557802907"> b = SF_Array.ConvertToDictionary(a)</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id421582557214490"> MsgBox b.Item("c") ' 3</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id731582557214490">End Sub</paragraph>
- </bascode>
- </section>
- <section id="CountDims">
- <comment> CountDims -------------------------------------------------------------------------------------------------------------------------- </comment>
- <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id251582558126024">
- <bookmark_value>Array service;CountDims</bookmark_value>
- </bookmark>
- <h2 id="hd_id761582558126025" localize="false">CountDims</h2>
- <paragraph role="paragraph" id="par_id671582558126025">Count the number of dimensions of an array. The result can be greater than two.
- <br/>If the argument is not an array, returns -1
- <br/>If the array is not initialized, returns 0.</paragraph>
- <h3 id="hd_id611582558126025" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id211582558126026">SF_Array.CountDims(Array_ND As Variant) As Integer</paragraph>
- </bascode>
- <h3 id="hd_id51582558126026" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
- <paragraph role="paragraph" id="par_id771582558126027"><emph>Array_ND</emph> : the array to examine.</paragraph>
- <h3 id="hd_id611582558126028" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id931582558126028">Sub Example_CountDims()</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id661582558126028">Dim a(1 To 10, -3 To 12, 5)</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id291582558126028"> MsgBox SF_Array.CountDims(a) ' 3</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id871582558126028">End Sub</paragraph>
- </bascode>
- </section>
- <section id="Difference">
- <comment> Difference -------------------------------------------------------------------------------------------------------------------------- </comment>
- <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id941582558644286">
- <bookmark_value>Array service;Difference</bookmark_value>
- </bookmark>
- <h2 id="hd_id21582558644287" localize="false">Difference</h2>
- <paragraph role="paragraph" id="par_id91582558644287">Build a set, as a zero-based array, by applying the difference operator on the two input arrays. Resulting items originate from the first array and not from the second.
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id291626977283235">
+ <input>svc.ConvertToDictionary(array_2d: any[0..*, 0..1]): obj</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id561582557214489"><emph>array_2d</emph>: Data to be converted into a <literal>ScriptForge.Dictionary</literal> object.</paragraph>
+ <list type="unordered">
+ <listitem>
+ <paragraph id="par_id781626977460310" role="listitem">The first column must contain exclusively strings with a length greater than zero, in any order. These values will be used as labels in the dictionary.</paragraph>
+ </listitem>
+ <listitem>
+ <paragraph id="par_id511626977461127" role="listitem">The second column contains the data that will be associated to the corresponding label in the dictionary.</paragraph>
+ </listitem>
+ </list>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id921582557214490">Dim a As Variant, b As Variant</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id261582557214490">a = SF_Array.AppendColumn(Array("a", "b", "c"), Array(1, 2, 3))</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id931582557802907">b = SF_Array.ConvertToDictionary(a)</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id421582557214490">MsgBox b.Item("c") ' 3</paragraph>
+ </bascode>
+</section>
+
+<section id="Copy">
+ <comment> Copy --------------------------------------------------------------------------------------------------- </comment>
+ <bookmark localize="false" branch="index" id="bm_id251582558126024">
+ <bookmark_value>Array service;Copy</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id991627154151529">Copy</h2>
+ <paragraph role="paragraph" id="par_id571627154604275">Creates a copy of a 1D or 2D array.</paragraph>
+ <embed href="text/sbasic/shared/03/avail_release.xhp#7.2.method"/>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id901627155659667">
+ <input>svc.Copy(array_nd: any[0..*]): any[0..*]</input>
+ </paragraph>
+ <paragraph role="paragraph" localize="false" id="par_id901627155659568">
+ <input>svc.Copy(array_nd: any[0..*, 0..*]): any[0..*, 0..*]</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id191627155816815"><emph>array_nd</emph>: The 1D or 2D array to be copied.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <paragraph role="paragraph" id="par_id451627155478940">A simple assignment of an <literal>Array</literal> object will copy its reference instead of creating a copy of the object's contents. See the example below:</paragraph>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id881627155939064">Dim a as Variant, b as Variant</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id71627155939296">a = Array(1, 2, 3)</paragraph>
+ <paragraph role="bascode" id="bas_id801627155939671">' The assignment below is made by reference</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id461627155939477">b = a</paragraph>
+ <paragraph role="bascode" id="bas_id291627156013810">' Hence changing values in "b" will also change "a"</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id771627155939894">b(0) = 10</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id531627155940118">MsgBox a(0) ' 10</paragraph>
+ </bascode>
+ <paragraph role="paragraph" id="par_id701627155874259">By using the <literal>Copy</literal> method, a copy of the whole <literal>Array</literal> object is made. In the example below, <literal>a</literal> and <literal>b</literal> are different objects and changing values in <literal>b</literal> will not affect values in <literal>a</literal>.</paragraph>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id551627156150612">Dim a as Variant, b as Variant</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id781627156150904">a = Array(1, 2, 3)</paragraph>
+ <paragraph role="bascode" id="bas_id141627156152196">' Creates a copy of "a" using the "Copy" method</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id391627156151116">b = SF_Array.Copy(a)</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id661627156151494">b(0) = 10</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id311627156151972">MsgBox a(0) ' 1</paragraph>
+ </bascode>
+</section>
+
+<section id="CountDims">
+ <comment> CountDims ---------------------------------------------------------------------------------------------- </comment>
+ <bookmark localize="false" branch="index" id="bm_id251582558126024">
+ <bookmark_value>Array service;CountDims</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id761582558126025" localize="false">CountDims</h2>
+ <paragraph role="paragraph" id="par_id671582558126025">Count the number of dimensions of an array. The result can be greater than two.
+ <br/>If the argument is not an array, returns -1
+ <br/>If the array is not initialized, returns 0.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id591626977644227">
+ <input>svc.CountDims(array_nd: any): int</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id771582558126027"><emph>array_nd</emph>: The array to examine.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id661582558126028">Dim a(1 To 10, -3 To 12, 5)</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id291582558126028">MsgBox SF_Array.CountDims(a) ' 3</paragraph>
+ </bascode>
+</section>
+
+<section id="Difference">
+ <comment> Difference --------------------------------------------------------------------------------------------- </comment>
+ <bookmark localize="false" branch="index" id="bm_id941582558644286">
+ <bookmark_value>Array service;Difference</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id21582558644287" localize="false">Difference</h2>
+ <paragraph role="paragraph" id="par_id91582558644287">Build a set, as a zero-based array, by applying the difference operator on the two input arrays. Resulting items originate from the first array and not from the second.
<br/>The resulting array is sorted in ascending order.
<br/>Both input arrays must be filled homogeneously, their items must be scalars of the same type. <literal>Empty</literal> and <literal>Null</literal> items are forbidden.
<br/>Text comparison can be case sensitive or not.</paragraph>
- <h3 id="hd_id441582558644287" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id491582558644287">SF_Array.Difference(Array1_1D As Variant, Array2_1D As Variant[, CaseSensitive As Boolean]) As Variant</paragraph>
- </bascode>
- <h3 id="hd_id641582558644287" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
- <paragraph role="paragraph" id="par_id271582558644287"><emph>Array1_1D</emph> : A 1 dimension reference array, whose items are examined for removal.</paragraph>
- <paragraph role="paragraph" id="par_id141582558644287"><emph>Array2_1D</emph> : A 1 dimension array, whose items are subtracted from the first input array.</paragraph>
- <paragraph role="paragraph" id="par_id291582559651473"><emph>CaseSensitive</emph> : Only if the arrays are populated with strings, default = <literal>False</literal>.</paragraph>
- <h3 id="hd_id811582558644287" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id151582558644288">Sub Example_Difference()</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id141582558644288">Dim a As Variant</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id971582560754091"> a = SF_Array.Difference(Array("A", "C", "A", "b", "B"), Array("C", "Z", "b"), True)</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id281582560766794"> ' ("A", "B")</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id871582558644288">End Sub</paragraph>
- </bascode>
- </section>
- <section id="ExportToTextFile">
- <comment> ExportToTextFile -------------------------------------------------------------------------------------------------------------------------- </comment>
- <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_iid101582629162107">
- <bookmark_value>Array service;ExportToTextFile</bookmark_value>
- </bookmark>
- <h2 id="hd_id231586179707778" localize="false">ExportToTextFile</h2>
- <paragraph role="paragraph" id="par_id941586179707156">Write all items of the array sequentially to a text file. If the file exists already, it will be overwritten without warning.</paragraph>
- <h3 id="hd_id831586179707159" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id54158617970786">SF_Array.ExportToTextFile(Array_1D As Variant, FileName As String, [Encoding As String]) As Boolean</paragraph>
- </bascode>
- <h3 id="hd_id44158617970749" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
- <paragraph role="paragraph" id="par_id100158617970719"><emph>Array_1D</emph> : The array to export. It must contain only strings.</paragraph>
- <paragraph role="paragraph" id="par_id101586179707232"><emph>FileName</emph> : the name of the text file containing the data. The name is expressed as given by the current <literal>FileNaming</literal> property of the <literal>SF_FileSystem</literal> service. Default = any (both the URL format and the native operating system format are admitted).</paragraph>
- <paragraph role="paragraph" id="par_id70158617970791" xml-lang="en-US"><emph>Encoding</emph> : The character set that should be used. Use one of the names listed in <link href="https://www.iana.org/assignments/character-sets/character-sets.xhtml" name="IANA character sets">IANA character sets</link>. Note that %PRODUCTNAME may not implement all existing character sets. Default is "UTF-8".</paragraph>
- <h3 id="hd_id281586179707112" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id831586179707765">Sub Example_ExportToTextFile()</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id551586179707687"> SF_Array.ExportToTextFile(Array("A","B","C","D"), "C:\Temp\A short file.txt")</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id241586179707813">End Sub</paragraph>
- </bascode>
- </section>
- <section id="ExtractColumn">
- <comment> ExtractColumn -------------------------------------------------------------------------------------------------------------------------- </comment>
- <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id891582560281081">
- <bookmark_value>Array service;ExtractColumn</bookmark_value>
- </bookmark>
- <h2 id="hd_id721582560281081" localize="false">ExtractColumn</h2>
- <paragraph role="paragraph" id="par_id171582560281082">Extract from a two dimension array a specific column as a new array.
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id311626977822374">
+ <input>svc.Difference(array1_1d: any[0..*], array2_1d: any[0..*], casesensitive: bool = False): any[0..*]</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id271582558644287"><emph>array1_1d</emph>: A 1-dimensional reference array, whose items are examined for removal.</paragraph>
+ <paragraph role="paragraph" id="par_id141582558644287"><emph>array2_1d</emph>: A 1-dimensional array, whose items are subtracted from the first input array.</paragraph>
+ <paragraph role="paragraph" id="par_id291582559651473"><emph>casesensitive</emph>: This argument is only applicable if the arrays are populated with strings (Default = <literal>False</literal>).</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id141582558644288">Dim a As Variant</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id971582560754091">a = SF_Array.Difference(Array("A", "C", "A", "b", "B"), Array("C", "Z", "b"), True)</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id281582560766794"> ' ("A", "B")</paragraph>
+ </bascode>
+</section>
+
+<section id="ExportToTextFile">
+ <comment> ExportToTextFile --------------------------------------------------------------------------------------- </comment>
+ <bookmark localize="false" branch="index" id="bm_iid101582629162107">
+ <bookmark_value>Array service;ExportToTextFile</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id231586179707778" localize="false">ExportToTextFile</h2>
+ <paragraph role="paragraph" id="par_id941586179707156">Write all items of the array sequentially to a text file. If the file exists already, it will be overwritten without warning.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id701626978046046">
+ <input>svc.ExportToTextFile(array_1d: any[0..*], filename: str, [encoding: str]): bool</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id100158617970719"><emph>array_1d</emph>: The array to export. It must contain only strings.</paragraph>
+ <paragraph role="paragraph" id="par_id101586179707232"><emph>filename</emph>: The name of the text file where the data will be written to. The name must be expressed according to the current <literal>FileNaming</literal> property of the <literal>SF_FileSystem</literal> service.</paragraph>
+ <paragraph role="paragraph" id="par_id70158617970791"><emph>encoding</emph>: The character set that should be used. Use one of the names listed in <link href="https://www.iana.org/assignments/character-sets/character-sets.xhtml" name="IANA character sets">IANA character sets</link>. Note that %PRODUCTNAME may not implement all existing character sets (Default is "UTF-8").</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id551586179707687">SF_Array.ExportToTextFile(Array("A","B","C","D"), "C:\Temp\A short file.txt")</paragraph>
+ </bascode>
+</section>
+
+<section id="ExtractColumn">
+ <comment> ExtractColumn ------------------------------------------------------------------------------------------ </comment>
+ <bookmark localize="false" branch="index" id="bm_id891582560281081">
+ <bookmark_value>Array service;ExtractColumn</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id721582560281081" localize="false">ExtractColumn</h2>
+ <paragraph role="paragraph" id="par_id171582560281082">Extract from a two dimension array a specific column as a new array.
<br/>Its lower <literal>LBound</literal> and upper <literal>UBound</literal> boundaries are identical to that of the first dimension of the input array.</paragraph>
- <h3 id="hd_id341582560281082" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id821582560281083">SF_Array.ExtractColumn(Array_2D As Variant, ColumnIndex As Long) As Variant</paragraph>
- </bascode>
- <h3 id="hd_id841582560281083" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
- <paragraph role="paragraph" id="par_id301582560281083"><emph>Array_2D</emph> : The array from which to extract.</paragraph>
- <paragraph role="paragraph" id="par_id421582560281084"><emph>ColumnIndex</emph> : The column number to extract - must be in the interval <literal>[LBound, UBound]</literal>.</paragraph>
- <h3 id="hd_id111582560281085" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id821582560281085">Sub Example_ExtractColumn</paragraph>
- <paragraph role="bascode" id="bas_id861609975902708"> 'Creates a 3x3 matrix: |1, 2, 3|</paragraph>
- <paragraph role="bascode" localize="false" id="par_id921609975924606"> ' |4, 5, 6|</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id891609975939001"> ' |7, 8, 9|</paragraph>
- <paragraph role="bascode" localize="false" id="par_id511609975955899"> Dim mat as Variant, col as Variant</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id831582560741676"> mat = SF_Array.AppendRow(Array(), Array(1, 2, 3))</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id661582560281085"> mat = SF_Array.AppendRow(mat, Array(4, 5, 6))</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id941609976001528"> mat = SF_Array.AppendRow(mat, Array(7, 8, 9))</paragraph>
- <paragraph role="bascode" id="bas_id431609976009994"> 'Extracts the third column: |3, 6, 9|</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id71609976022964"> col = SF_Array.ExtractColumn(mat, 2)</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id471609976068079">End Sub</paragraph>
- </bascode>
- </section>
- <section id="ExtractRow">
- <comment> ExtractRow -------------------------------------------------------------------------------------------------------------------------- </comment>
- <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id891582561395261">
- <bookmark_value>Array service;ExtractRow</bookmark_value>
- </bookmark>
- <h2 id="hd_id921582561457245" localize="false">ExtractRow</h2>
- <paragraph role="paragraph" id="par_id211582561467219">Extract from a two dimension array a specific row as a new array.
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id251626978426782">
+ <input>svc.ExtractColumn(array_2d: any[0..*, 0..*], columnindex: int): any[0..*, 0..*]</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id301582560281083"><emph>array_2d</emph>: The array from which to extract.</paragraph>
+ <paragraph role="paragraph" id="par_id421582560281084"><emph>columnindex</emph>: The column number to extract - must be in the interval <literal>[LBound, UBound]</literal>.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <bascode>
+ <paragraph role="bascode" id="bas_id861609975902708">'Creates a 3x3 matrix: |1, 2, 3|</paragraph>
+ <paragraph role="bascode" localize="false" id="par_id921609975924606">' |4, 5, 6|</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id891609975939001">' |7, 8, 9|</paragraph>
+ <paragraph role="bascode" localize="false" id="par_id511609975955899">Dim mat as Variant, col as Variant</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id831582560741676">mat = SF_Array.AppendRow(Array(), Array(1, 2, 3))</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id661582560281085">mat = SF_Array.AppendRow(mat, Array(4, 5, 6))</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id941609976001528">mat = SF_Array.AppendRow(mat, Array(7, 8, 9))</paragraph>
+ <paragraph role="bascode" id="bas_id431609976009994">'Extracts the third column: |3, 6, 9|</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id71609976022964">col = SF_Array.ExtractColumn(mat, 2)</paragraph>
+ </bascode>
+</section>
+
+<section id="ExtractRow">
+ <comment> ExtractRow --------------------------------------------------------------------------------------------- </comment>
+ <bookmark localize="false" branch="index" id="bm_id891582561395261">
+ <bookmark_value>Array service;ExtractRow</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id921582561457245" localize="false">ExtractRow</h2>
+ <paragraph role="paragraph" id="par_id211582561467219">Extract from a two dimension array a specific row as a new array.
<br/>Its lower <literal>LBound</literal> and upper <literal>UBound</literal> boundaries are identical to that of the second dimension of the input array.</paragraph>
- <h3 id="hd_id271582561491472" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id531582561508949">SF_Array.ExtractRow(Array_2D As Variant, RowIndex As Long) As Variant</paragraph>
- </bascode>
- <h3 id="hd_id151582561525826" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
- <paragraph role="paragraph" id="par_id911582561542889"><emph>Array_2D</emph> : The array from which to extract.</paragraph>
- <paragraph role="paragraph" id="par_id441582561551202"><emph>RowIndex</emph> : The row number to extract - must be in the interval <literal>[LBound, UBound]</literal>.</paragraph>
- <h3 id="hd_id891582561576040" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id941582561596912">Sub Example_ExtractRow</paragraph>
- <paragraph role="bascode" id="bas_id301582561604167"> 'Creates a 3x3 matrix: |1, 2, 3|</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id100158256161206"> ' |4, 5, 6|</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id91609976515742"> ' |7, 8, 9|</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id911609976539433"> Dim mat as Variant, row as Variant</paragraph>
- <paragraph role="bascode" localize="false" id="par_id921609976603577"> mat = SF_Array.AppendRow(Array(), Array(1, 2, 3))</paragraph>
- <paragraph role="bascode" localize="false" id="par_id281609976618980"> mat = SF_Array.AppendRow(mat, Array(4, 5, 6))</paragraph>
- <paragraph role="bascode" localize="false" id="par_id591609976629882"> mat = SF_Array.AppendRow(mat, Array(7, 8, 9))</paragraph>
- <paragraph role="bascode" id="bas_id431609976648017"> 'Extracts the first row: |1, 2, 3|</paragraph>
- <paragraph role="bascode" localize="false" id="par_id781609976663979"> row = SF_Array.ExtractRow(mat, 0)</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id921609976680335">End Sub</paragraph>
- </bascode>
- </section>
- <section id="Flatten">
- <comment> Flatten -------------------------------------------------------------------------------------------------------------------------- </comment>
- <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id261585757822682">
- <bookmark_value>Array service;Flatten</bookmark_value>
- </bookmark>
- <h2 id="hd_id351585757822637" localize="false">Flatten</h2>
- <paragraph role="paragraph" id="par_id431585757822181">Stack all single items of an array and all items in its subarrays into one new array without subarrays. Empty subarrays are ignored and subarrays with a number of dimensions greater than one are not flattened.</paragraph>
- <h3 id="hd_id861585757822848" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id61585757822431">SF_Array.Flatten(Array_1D As Variant) As Variant</paragraph>
- </bascode>
- <h3 id="hd_id231585757822628" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
- <paragraph role="paragraph" id="par_id431585757822869"><emph>Array_1D</emph> : the pre-existing array, may be empty.</paragraph>
- <h3 id="hd_id70158575782242" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id721585757822109">Sub Example_Flatten()</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id231585757822493">Dim a As Variant</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id131585757822885"> a = SF_Array.Flatten(Array(Array(1, 2, 3), 4, 5))</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id631585757822119"> ' (1, 2, 3, 4, 5)</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id141585757822713">End Sub</paragraph>
- </bascode>
- <tip id="par_id291610040786530">You can use the <literal>Flatten</literal> method along with other methods such as <literal>Append</literal> or <literal>Prepend</literal> to concatenate a set of 1D arrays into a single 1D array.</tip>
- <h3 id="hd_id361610040935558" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
- <paragraph role="paragraph" id="par_id941610040961148">Next is an example of how the methods <literal>Flatten</literal> and <literal>Append</literal> can be combined to concatenate three arrays.</paragraph>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id741610041055558">Sub Concatenate_Example</paragraph>
- <paragraph role="bascode" id="bas_id841610041372527"> 'Creates three arrays for this example</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id711610041389170"> Dim a as Variant, b as Variant, c as Variant</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id231610041401412"> a = Array(1, 2, 3)</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id281610041413482"> b = Array(4, 5)</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id651610041429583"> c = Array(6, 7, 8, 9)</paragraph>
- <paragraph role="bascode" id="bas_id171610041440657"> 'Concatenates the three arrays into a single 1D array</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id331610041455317"> Dim arr as Variant</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id121610041468254"> arr = SF_Array.Flatten(SF_Array.Append(a, b, c))</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id981610041490008"> '(1, 2, 3, 4, 5, 6, 7, 8, 9)</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id431610041500145">End Sub</paragraph>
- </bascode>
- </section>
- <section id="ImportFromCSVFile">
- <comment> ImportFromCSVFile -------------------------------------------------------------------------------------------------------------------------- </comment>
- <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_iid101582629162107">
- <bookmark_value>Array service;ImportFromCSVFile</bookmark_value>
- </bookmark>
- <h2 id="hd_id581585561482142" localize="false">ImportFromCSVFile</h2>
- <paragraph role="paragraph" id="par_id611585561482373">Import the data contained in a comma-separated values (CSV) file. The comma may be replaced by any character.</paragraph>
- <paragraph role="paragraph" id="par_id41585562158392" xml-lang="en-US">The applicable CSV format is described in <link href="https://tools.ietf.org/html/rfc4180" name="CSV formats">IETF Common Format and MIME Type for CSV Files</link>.</paragraph>
- <paragraph role="paragraph" id="par_id641585562341028" xml-lang="en-US">Each line in the file contains a full record (line splitting is not allowed).
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id391626978560113">
+ <input>svc.ExtractRow(array_2d: any[0..*, 0..*], rowindex: int): any[0..*, 0..*]</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id911582561542889"><emph>array_2d</emph>: The array from which to extract.</paragraph>
+ <paragraph role="paragraph" id="par_id441582561551202"><emph>rowindex</emph>: The row number to extract - must be in the interval <literal>[LBound, UBound]</literal>.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <bascode>
+ <paragraph role="bascode" id="bas_id301582561604167">'Creates a 3x3 matrix: |1, 2, 3|</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id100158256161206">' |4, 5, 6|</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id91609976515742">' |7, 8, 9|</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id911609976539433">Dim mat as Variant, row as Variant</paragraph>
+ <paragraph role="bascode" localize="false" id="par_id921609976603577">mat = SF_Array.AppendRow(Array(), Array(1, 2, 3))</paragraph>
+ <paragraph role="bascode" localize="false" id="par_id281609976618980">mat = SF_Array.AppendRow(mat, Array(4, 5, 6))</paragraph>
+ <paragraph role="bascode" localize="false" id="par_id591609976629882">mat = SF_Array.AppendRow(mat, Array(7, 8, 9))</paragraph>
+ <paragraph role="bascode" id="bas_id431609976648017">'Extracts the first row: |1, 2, 3|</paragraph>
+ <paragraph role="bascode" localize="false" id="par_id781609976663979">row = SF_Array.ExtractRow(mat, 0)</paragraph>
+ </bascode>
+</section>
+
+<section id="Flatten">
+ <comment> Flatten ------------------------------------------------------------------------------------------------ </comment>
+ <bookmark localize="false" branch="index" id="bm_id261585757822682">
+ <bookmark_value>Array service;Flatten</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id351585757822637" localize="false">Flatten</h2>
+ <paragraph role="paragraph" id="par_id431585757822181">Stack all single items of an array and all items in its subarrays into one new array without subarrays. Empty subarrays are ignored and subarrays with a number of dimensions greater than one are not flattened.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id551626978750851">
+ <input>svc.Flatten(array_1d: any[0..*]): any[0..*]</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id431585757822869"><emph>array_1d</emph>: The pre-existing array, may be empty.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id231585757822493">Dim a As Variant</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id131585757822885">a = SF_Array.Flatten(Array(Array(1, 2, 3), 4, 5))</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id631585757822119"> ' (1, 2, 3, 4, 5)</paragraph>
+ </bascode>
+ <tip id="par_id291610040786530">You can use the <literal>Flatten</literal> method along with other methods such as <literal>Append</literal> or <literal>Prepend</literal> to concatenate a set of 1D arrays into a single 1D array.</tip>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <paragraph role="paragraph" id="par_id941610040961148">Next is an example of how the methods <literal>Flatten</literal> and <literal>Append</literal> can be combined to concatenate three arrays.</paragraph>
+ <bascode>
+ <paragraph role="bascode" id="bas_id841610041372527">'Creates three arrays for this example</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id711610041389170">Dim a as Variant, b as Variant, c as Variant</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id231610041401412">a = Array(1, 2, 3)</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id281610041413482">b = Array(4, 5)</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id651610041429583">c = Array(6, 7, 8, 9)</paragraph>
+ <paragraph role="bascode" id="bas_id171610041440657">'Concatenates the three arrays into a single 1D array</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id331610041455317">Dim arr as Variant</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id121610041468254">arr = SF_Array.Flatten(SF_Array.Append(a, b, c))</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id981610041490008">'(1, 2, 3, 4, 5, 6, 7, 8, 9)</paragraph>
+ </bascode>
+</section>
+
+<section id="ImportFromCSVFile">
+ <comment> ImportFromCSVFile -------------------------------------------------------------------------------------- </comment>
+ <bookmark localize="false" branch="index" id="bm_iid101582629162107">
+ <bookmark_value>Array service;ImportFromCSVFile</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id581585561482142" localize="false">ImportFromCSVFile</h2>
+ <paragraph role="paragraph" id="par_id611585561482373">Import the data contained in a comma-separated values (CSV) file. The comma may be replaced by any character.</paragraph>
+ <paragraph role="paragraph" id="par_id41585562158392">The applicable CSV format is described in <link href="https://tools.ietf.org/html/rfc4180" name="CSV formats">IETF Common Format and MIME Type for CSV Files</link>.</paragraph>
+ <paragraph role="paragraph" id="par_id641585562341028">Each line in the file contains a full record (line splitting is not allowed).
<br/>However sequences like <literal>\n</literal>, <literal>\t</literal>, ... are left unchanged. Use <literal>SF_String</literal>.Unescape() method to manage them.</paragraph>
- <paragraph role="paragraph" id="par_id231585562475026" xml-lang="en-US">The method returns a two dimension array whose rows correspond to a single record read in the file and whose columns correspond to a field of the record. No check is made about the coherence of the field types across columns. A best guess will be made to identify numeric and date types.</paragraph>
- <paragraph role="paragraph" id="par_id101585562548245" xml-lang="en-US">If a line contains less or more fields than the first line in the file, an exception will be raised. Empty lines however are simply ignored. If the size of the file exceeds the number of items limit (see inside the code), a warning is raised and the array is truncated.</paragraph>
- <h3 id="hd_id171585561482793" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id351585561482418">SF_Array.ImportFromCSVFile(FileName As String, [Delimiter As String], [DateFormat As String]) As Variant</paragraph>
- </bascode>
- <h3 id="hd_id461585561482379" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
- <paragraph role="paragraph" id="par_id441585561482121"><emph>FileName</emph> : the name of the text file containing the data. The name is expressed as given by the current <literal>FileNaming</literal> property of the <literal>SF_FileSystem</literal> service. Default = any (both the URL format and the native operating system format are admitted).</paragraph>
- <paragraph role="paragraph" id="par_id251585561482929"><emph>Delimiter</emph> : A single character, usually, a comma, a semicolon or a TAB character. Default = <literal>","</literal>.</paragraph>
- <paragraph role="paragraph" id="par_id631585563491559" xml-lang="en-US"><emph>DateFormat</emph> : A special mechanism handles dates when <literal>DateFormat</literal> is either "YYYY-MM-DD", "DD-MM-YYYY" or "MM-DD-YYYY". The dash (-) may be replaced by a dot (.), a slash (/) or a space. Other date formats will be ignored. Dates defaulting to "" are considered as normal text.</paragraph>
- <h3 id="hd_id52158556148278" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
- <paragraph role="paragraph" id="par_id61585564516409" xml-lang="en-US">Given this CSV file:</paragraph>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id891585564144231">Name,DateOfBirth,Address,City</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id761585564150479">Anna,2002/03/31,"Rue de l'église, 21",Toulouse</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id911585564157141">Fred,1998/05/04,"Rue Albert Einstein, 113A",Carcassonne</paragraph>
- </bascode>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id321585561482696">Sub Example_ImportFromCSVFile()</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id391585561482567">Dim a As Variant</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id531585561482408"> a = SF_Array.ImportFromCSVFile("C:\Temp\myFile.csv", DateFormat := "YYYY/MM/DD")</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id621585561482783"> MsgBox a(0, 3) ' City</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id21585564425349"> MsgBox TypeName(a(1, 2)) ' Date</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id831585564433851"> MsgBox a(2, 2) ' Rue Albert Einstein, 113A</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id591585561482616">End Sub</paragraph>
- </bascode>
- </section>
- <section id="IndexOf">
- <comment> IndexOf -------------------------------------------------------------------------------------------------------------------------- </comment>
- <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id361582562709465">
- <bookmark_value>Array service;IndexOf</bookmark_value>
- </bookmark>
- <h2 id="hd_id741582562715741" localize="false">IndexOf</h2>
- <paragraph role="paragraph" id="par_id211582562721860">Look in a one dimension array for a number, a string or a date. Text comparison can be case-sensitive or not.
+ <paragraph role="paragraph" id="par_id231585562475026">The method returns a two dimension array whose rows correspond to a single record read in the file and whose columns correspond to a field of the record. No check is made about the coherence of the field types across columns. A best guess will be made to identify numeric and date types.</paragraph>
+ <paragraph role="paragraph" id="par_id101585562548245">If a line contains less or more fields than the first line in the file, an exception will be raised. Empty lines however are simply ignored. If the size of the file exceeds the number of items limit (see inside the code), a warning is raised and the array is truncated.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id121626979017138">
+ <input>svc.ImportFromCSVFile(filename: str, delimiter: str = ',', dateformat: str = ''): any[0..*]</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id441585561482121"><emph>filename</emph>: The name of the text file containing the data. The name must be expressed according to the current <literal>FileNaming</literal> property of the <literal>SF_FileSystem</literal> service.</paragraph>
+ <paragraph role="paragraph" id="par_id251585561482929"><emph>delimiter</emph>: A single character, usually, a comma, a semicolon or a TAB character (Default = ",").</paragraph>
+ <paragraph role="paragraph" id="par_id631585563491559"><emph>dateformat</emph>: A special mechanism handles dates when <literal>dateformat</literal> is either "YYYY-MM-DD", "DD-MM-YYYY" or "MM-DD-YYYY". The dash (-) may be replaced by a dot (.), a slash (/) or a space. Other date formats will be ignored. Dates defaulting to an empty string "" are considered as normal text.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <paragraph role="paragraph" id="par_id61585564516409">Consider the CSV file "myFile.csv" with the following contents:</paragraph>
+ <paragraph role="paragraph" localize="false" id="par_id281626980354105"><input>Name,DateOfBirth,Address,City</input></paragraph>
+ <paragraph role="paragraph" localize="false" id="par_id301626980648833"><input>Anna,2002/03/31,"Rue de l'église, 21",Toulouse</input></paragraph>
+ <paragraph role="paragraph" localize="false" id="par_id881626980658900"><input>Fred,1998/05/04,"Rue Albert Einstein, 113A",Carcassonne</input></paragraph>
+ <paragraph role="paragraph" id="par_id181626979812772">The examples below in Basic and Python read the contents of the CSV file into an <literal>Array</literal> object.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Basic"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id391585561482567">Dim arr As Variant</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id531585561482408">arr = SF_Array.ImportFromCSVFile("C:\Temp\myFile.csv", DateFormat := "YYYY/MM/DD")</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id621585561482783">MsgBox arr(0, 3) ' City</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id21585564425349">MsgBox arr(1, 2) ' Rue de l'église, 21</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id831585564433851">MsgBox arr(1, 3) ' Toulouse</paragraph>
+ </bascode>
+ <embed href="text/sbasic/shared/00000003.xhp#In_Python"/>
+ <pycode>
+ <paragraph role="pycode" localize="false" id="pyc_id851626979992344">from scriptforge import CreateScriptService</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id571626979992587">svc = CreateScriptService("Array")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id821626979992775">bas = CreateScriptService("Basic")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id511626979992999">arr = svc.ImportFromCSVFile(r"C:\Temp\myFile.csv", dateformat = "YYYY/MM/DD")</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id211626979993191">bas.MsgBox(arr[0][3]) # City</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id671626979993408">bas.MsgBox(arr[1][2]) # Rue de l'église, 21</paragraph>
+ <paragraph role="pycode" localize="false" id="pyc_id481626979993648">bas.MsgBox(arr[1][3]) # Toulouse</paragraph>
+ </pycode>
+</section>
+
+<section id="IndexOf">
+ <comment> IndexOf ------------------------------------------------------------------------------------------------ </comment>
+ <bookmark localize="false" branch="index" id="bm_id361582562709465">
+ <bookmark_value>Array service;IndexOf</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id741582562715741" localize="false">IndexOf</h2>
+ <paragraph role="paragraph" id="par_id211582562721860">Look in a one dimension array for a number, a string or a date. Text comparison can be case-sensitive or not.
<br/>If the array is sorted it must be filled homogeneously, which means that all items must be scalars of the same type (<literal>Empty</literal> and <literal>Null</literal> items are forbidden).
<br/>The result of the method is unpredictable when the array is announced as sorted and actually is not.
<br/>A binary search is performed on sorted arrays. Otherwise, arrays are simply scanned from top to bottom and <literal>Empty</literal> and <literal>Null</literal> items are ignored.
<br/>
<br/>The method returns <literal>LBound(input array) - 1</literal> if the search was not successful.</paragraph>
- <h3 id="hd_id901582562736452" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id251582562747218">SF_Array.IndexOf(Array_1D, ToFind As Variant, [CaseSensitive As Boolean], [SortOrder As String]) As Long</paragraph>
- </bascode>
- <h3 id="hd_id11582562760632" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
- <paragraph role="paragraph" id="par_id315825627687760"><emph>Array_1D</emph> : the array to scan.</paragraph>
- <paragraph role="paragraph" id="par_id511582562775516"><emph>ToFind</emph> : a number, a date or a string to find.</paragraph>
- <paragraph role="paragraph" id="par_id311582562787187"><emph>CaseSensitive</emph> : Only for string comparisons, default = <literal>False</literal>.</paragraph>
- <paragraph role="paragraph" id="par_id421582562794501"><emph>SortOrder</emph> : <literal>"ASC"</literal>, <literal>"DESC"</literal> or <literal>""</literal> (= not sorted, default)</paragraph>
- <h3 id="hd_id121582562803122" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id471582562909129">Sub Example_IndexOf()</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id291582562917140"> MsgBox SF_Array.IndexOf(Array("A","B","c","D"), "C", SortOrder := "ASC") ' 2</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id100158256292397"> MsgBox SF_Array.IndexOf(Array("A","B","c","D"), "C", CaseSensitive := True) ' -1</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id641582562955330">End Sub</paragraph>
- </bascode>
- </section>
- <section id="Insert">
- <comment> Insert -------------------------------------------------------------------------------------------------------------------------- </comment>
- <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id371582626951108">
- <bookmark_value>Array service;Insert</bookmark_value>
- </bookmark>
- <h2 id="hd_id101582626951109" localize="false">Insert</h2>
- <paragraph role="paragraph" id="par_id911582626951109">Insert before a given index of the input array the items listed as arguments.
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id741626980743030">
+ <input>svc.IndexOf(array_1d: any[0..*], tofind: any, casesensitive: bool = False, sortorder: str = ''): int</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id315825627687760"><emph>array_1d</emph>: The array to scan.</paragraph>
+ <paragraph role="paragraph" id="par_id511582562775516"><emph>tofind</emph>: A number, a date or a string to find.</paragraph>
+ <paragraph role="paragraph" id="par_id311582562787187"><emph>casesensitive</emph>: Only for string comparisons (Default = <literal>False</literal>).</paragraph>
+ <paragraph role="paragraph" id="par_id421582562794501"><emph>sortorder</emph>: It can be either "ASC", "DESC" or "" (not sorted). The default value is "".</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id291582562917140">MsgBox SF_Array.IndexOf(Array("A","B","c","D"), "C", SortOrder := "ASC") ' 2</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id100158256292397">MsgBox SF_Array.IndexOf(Array("A","B","c","D"), "C", CaseSensitive := True) ' -1</paragraph>
+ </bascode>
+</section>
+
+<section id="Insert">
+ <comment> Insert ------------------------------------------------------------------------------------------------- </comment>
+ <bookmark localize="false" branch="index" id="bm_id371582626951108">
+ <bookmark_value>Array service;Insert</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id101582626951109" localize="false">Insert</h2>
+ <paragraph role="paragraph" id="par_id911582626951109">Insert before a given index of the input array the items listed as arguments.
<br/>Arguments are inserted blindly. Each of them might be either a scalar of any type or a subarray.</paragraph>
- <h3 id="hd_id811582626951110" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id821582626951110">SF_Array.Insert(Array_1D As Variant, Before As Long, arg0 As Variant, [arg1 As Variant], ...) As Variant</paragraph>
- </bascode>
- <h3 id="hd_id111582626951110" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
- <paragraph role="paragraph" id="par_id251582626951111"><emph>Array_1D</emph> : the pre-existing array, may be empty.</paragraph>
- <paragraph role="paragraph" id="par_id361582626951111"><emph>Before</emph> : the index before which to insert; must be in the interval <literal>[LBound, UBound + 1]</literal>.</paragraph>
- <paragraph role="paragraph" id="par_id41582626951111"><emph>arg0, ...</emph> : a list of items to insert inside <literal>Array_1D</literal>.</paragraph>
- <h3 id="hd_id401582626951112" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id701582626951112">Sub Example_Insert()</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id11582626951112">Dim a As Variant</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id231582626951113"> a = SF_Array.Insert(Array(1, 2, 3), 2, "a", "b")</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id841582626951113"> ' (1, 2, "a", "b", 3)</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id341582626951114">End Sub</paragraph>
- </bascode>
- </section>
- <section id="InsertSorted">
- <comment> InsertSorted -------------------------------------------------------------------------------------------------------------------------- </comment>
- <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id311582627664147">
- <bookmark_value>Array service;InsertSorted</bookmark_value>
- </bookmark>
- <h2 id="hd_id981582627664147" localize="false">InsertSorted</h2>
- <paragraph role="paragraph" id="par_id441582627664147">Insert in a sorted array a new item on its place.
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id701626981031599">
+ <input>svc.Insert(array_1d: any[0..*], before: int, arg0: any, [arg1: any] ...): any[0..*]</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id251582626951111"><emph>array_1d</emph>: The pre-existing array, may be empty.</paragraph>
+ <paragraph role="paragraph" id="par_id361582626951111"><emph>before</emph>: The index before which to insert; must be in the interval <literal>[LBound, UBound + 1]</literal>.</paragraph>
+ <paragraph role="paragraph" id="par_id41582626951111"><emph>arg0, arg1, ...</emph>: Items that will be inserted into <literal>array_1d</literal>.</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id11582626951112">Dim a As Variant</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id231582626951113">a = SF_Array.Insert(Array(1, 2, 3), 2, "a", "b")</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id841582626951113"> ' (1, 2, "a", "b", 3)</paragraph>
+ </bascode>
+</section>
+
+<section id="InsertSorted">
+ <comment> InsertSorted ------------------------------------------------------------------------------------------- </comment>
+ <bookmark localize="false" branch="index" id="bm_id311582627664147">
+ <bookmark_value>Array service;InsertSorted</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id981582627664147" localize="false">InsertSorted</h2>
+ <paragraph role="paragraph" id="par_id441582627664147">Inserts into a sorted array a new item on its place.
<br/>The array must be filled homogeneously, meaning that all items must be scalars of the same type.
<br/><literal>Empty</literal> and <literal>Null</literal> items are forbidden.</paragraph>
- <h3 id="hd_id621582627664147" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id61582627664147">SF_Array.InsertSorted(Array_1D As Variant, Item As Variant, SortOrder As String, CaseSensitive As Boolean) As Variant</paragraph>
- </bascode>
- <h3 id="hd_id941582627664147" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
- <paragraph role="paragraph" id="par_id121582627664147"><emph>Array_1D</emph> : The array to sort.</paragraph>
- <paragraph role="paragraph" id="par_id315826276641480"><emph>Item</emph> : The scalar value to insert, of the same type as the existing array items.</paragraph>
- <paragraph role="paragraph" id="par_id415826279771170"><emph>SortOrder</emph> : <literal>"ASC"</literal> (default) or <literal>"DESC"</literal>.</paragraph>
- <paragraph role="paragraph" id="par_id701582627970037"><emph>CaseSensitive</emph> : Only for string comparisons, default = <literal>False</literal>.</paragraph>
- <h3 id="hd_id461582627664148" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id261582627664148">Sub Example_InsertSorted()</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id91582627664148">Dim a As Variant</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id31582627664148"> a = SF_Array.InsertSorted(Array("A", "C", "a", "b"), "B", CaseSensitive := True)</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id831582627664148"> ' ("A", "B", "C", "a", "b")</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id591582627664148">End Sub</paragraph>
- </bascode>
- </section>
- <section id="Intersection">
- <comment> Intersection -------------------------------------------------------------------------------------------------------------------------- </comment>
- <bookmark xml-lang="en-US" localize="false" branch="index" id="bm_iid101582629162107">
- <bookmark_value>Array service;Intersection</bookmark_value>
- </bookmark>
- <h2 id="hd_id841582629169550" localize="false">Intersection</h2>
- <paragraph role="paragraph" id="par_id71582629177169">Build a set, as a zero-based array, by applying the intersection set operator on the two input arrays. Resulting items are contained in both arrays.
+ <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/>
+ <paragraph role="paragraph" localize="false" id="par_id561626981419647">
+ <input>svc.InsertSorted(array_1d: any[0..*], item: any, sortorder: str = 'ASC', casesensitive: bool = False): any[0..*]</input>
+ </paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functparameters"/>
+ <paragraph role="paragraph" id="par_id121582627664147"><emph>array_1d</emph>: The array into which the value will be inserted.</paragraph>
+ <paragraph role="paragraph" id="par_id315826276641480"><emph>item</emph>: The scalar value to insert, of the same type as the existing array items.</paragraph>
+ <paragraph role="paragraph" id="par_id415826279771170"><emph>sortorder</emph>: It can be either "ASC" (default) or "DESC".</paragraph>
+ <paragraph role="paragraph" id="par_id701582627970037"><emph>casesensitive</emph>: Only for string comparisons (Default = <literal>False</literal>).</paragraph>
+ <embed href="text/sbasic/shared/00000003.xhp#functexample"/>
+ <bascode>
+ <paragraph role="bascode" localize="false" id="bas_id91582627664148">Dim a As Variant</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id31582627664148">a = SF_Array.InsertSorted(Array("A", "C", "a", "b"), "B", CaseSensitive := True)</paragraph>
+ <paragraph role="bascode" localize="false" id="bas_id831582627664148"> ' ("A", "B", "C", "a", "b")</paragraph>
+ </bascode>
+</section>
+
+<section id="Intersection">
+ <comment> Intersection ------------------------------------------------------------------------------------------- </comment>
+ <bookmark localize="false" branch="index" id="bm_iid101582629162107">
+ <bookmark_value>Array service;Intersection</bookmark_value>
+ </bookmark>
+ <h2 id="hd_id841582629169550" localize="false">Intersection</h2>
+ <paragraph role="paragraph" id="par_id71582629177169">Build a set, as a zero-based array, by applying the intersection set operator on the two input arrays. Resulting items are contained in both arrays.
<br/>The resulting array is sorted in ascending order.
<br/>Both input arrays must be filled homogeneously, in other words all items must be scalars of the same type. <literal>Empty</literal> and <literal>Null</literal> items are forbidden.
<br/>Text comparison can be case sensitive or not.</paragraph>
- <h3 id="hd_id681582629188055" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id731582629197251">SF_Array.Intersection(Array1_1D As Variant, Array2_1D As Variant[, CaseSensitive As Boolean]) As Variant</paragraph>
- </bascode>
- <h3 id="hd_id431582629205750" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
- <paragraph role="paragraph" id="par_id881582629216169"><emph>Array1_1D</emph> : The first input array.</paragraph>
- <paragraph role="paragraph" id="par_id191582629223038"><emph>Array2_1D</emph> : The second input array.</paragraph>
- <paragraph role="paragraph" id="par_id71582629230275"><emph>CaseSensitive</emph> : Applies to arrays populated with text items, default = <literal>False</literal>.</paragraph>
- <h3 id="hd_id871582629239015" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
- <bascode>
- <paragraph role="bascode" localize="false" id="bas_id391582629249730">Sub Example_Intersection()</paragraph>
- <paragraph role="bascode" localize="false" id="bas_id331582629257228">Dim a As Variant</paragraph>
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list