403Webshell
Server IP : 121.121.20.254  /  Your IP : 216.73.217.101
Web Server : Microsoft-IIS/10.0
System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64
User : IUSR ( 0)
PHP Version : 8.3.28
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /Program Files/LibreOffice/help/en-US/text/sbasic/shared/03/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /Program Files/LibreOffice/help/en-US/text/sbasic/shared/03/sf_array.html
<!DOCTYPE html>
<html lang="en-US" dir="ltr">
<head>
<base href="../../../../../">
<noscript><meta http-equiv="refresh" content="0; URL=../../../../../en-US/noscript.html"></noscript>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>ScriptForge.Array service (SF_Array)</title>
<link rel="shortcut icon" href="media/navigation/favicon.ico">
<link type="text/css" href="normalize.css" rel="Stylesheet">
<link type="text/css" href="prism.css" rel="Stylesheet">
<link type="text/css" href="default.css" rel="Stylesheet">
<script type="text/javascript" src="polyfills.js"></script><script type="text/javascript" src="languages.js"></script><script type="text/javascript" src="en-US/langnames.js"></script><script type="text/javascript" src="flexsearch.debug.js"></script><script type="text/javascript" src="prism.js"></script><script type="text/javascript" src="help2.js" defer></script><script type="text/javascript" src="a11y-toggle.js" defer></script><script type="text/javascript" src="paginathing.js" defer></script><script type="text/javascript" src="en-US/bookmarks.js" defer></script><script type="text/javascript" src="en-US/contents.js" defer></script><script type="text/javascript" src="help.js" defer></script><meta name="viewport" content="width=device-width,initial-scale=1">
</head>
<body>
<header id="TopLeftHeader"><a class="symbol" href="en-US/text/shared/05/new_help.html"><div></div></a><a class="logo" href="en-US/text/shared/05/new_help.html"><p dir="auto">LibreOffice 24.2 Help</p></a><div class="dropdowns"><div class="modules">
<button type="button" data-a11y-toggle="modules-nav" id="modules" aria-haspopup="true" aria-expanded="false" aria-controls="modules-nav">Module</button><nav id="modules-nav" hidden=""></nav>
</div></div></header><aside class="leftside"><input id="accordion-1" name="accordion-menu" type="checkbox"><label for="accordion-1" dir="auto">Contents</label><div id="Contents" class="contents-treeview"></div></aside><div id="SearchFrame"><div id="Bookmarks">
<input id="search-bar" type="search" class="search" placeholder="Search in bookmarks for chosen module" dir="auto"><div class="nav-container" tabindex="0"><nav class="index" dir="auto"></nav></div>
</div></div>
<div id="DisplayArea" itemprop="softwareHelp" itemscope="true" itemtype="http://schema.org/SoftwareApplication">

<a name="abstract"></a>
  <a name="bm_id281613039222756"></a>
     <meta itemprop="keywords" content="Array service">
  

  <h1 id="bm_id781582391760253" dir="auto">
<a name="ArrayService"></a><span class="literal">ScriptForge</span>.<span class="literal">Array</span> service</h1>
  <p id="par_id991582454416549" class="paragraph" dir="auto">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 from and exporting to text files.</p>
  <p id="par_id681609955015503" class="paragraph" dir="auto">Arrays with more than two dimensions cannot be used with the methods in this service, the only exception being the <span class="literal">CountDims</span> method that accepts Arrays with any number of dimensions.</p>


  <p id="par_id651582454426538" class="paragraph" dir="auto">Array items may contain any type of value, including (sub)arrays.</p>

  <h2 id="hd_id981586595097630" dir="auto">Service invocation</h2>
  <p id="par_id141609955500101" class="paragraph" dir="auto">Before using the <span class="literal">Array</span> service the <span class="literal">ScriptForge</span> library needs to be loaded using:</p>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    GlobalScope.BasicLibraries.loadLibrary("ScriptForge")
  </code></pre></div>
  <p id="par_id461609955633383" class="paragraph" dir="auto">Loading the library will create the <span class="literal">SF_Array</span> object that can be used to call the methods in the <span class="literal">Array</span> service.</p>
  <p id="par_id63158659509728" class="paragraph" dir="auto">The following code snippets show the various ways to call methods in the <span class="literal">Array</span> service (the <span class="literal">Append</span> method is used as an example):</p>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    Dim arr : arr = Array(1, 2, 3)
    arr = SF_Array.Append(arr, 4)
  </code></pre></div>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    Dim arr : arr = Array(1, 2, 3)
    Dim svc : svc = SF_Array
    arr = svc.Append(arr, 4)
  </code></pre></div>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    Dim arr : arr = Array(1, 2, 3)
    Dim svc : svc = CreateScriptService("Array")
    arr = svc.Append(arr, 4)
  </code></pre></div>
  <div class="warning">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/warning.svg" alt="warning" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id571609956486468" dir="auto">Because Python has built-in list and tuple support, most of the methods in the <span class="literal">Array</span> service are available for Basic scripts only. The only exception is <span class="literal">ImportFromCSVFile</span> which is supported in both Basic and Python.</p></div>
</div>
<br>
  <a name="methods_toc"></a>
  <table border="1" class="" cellpadding="0" cellspacing="0">
  <tr>
    <th rowspan="" colspan="3" class="tableheadcell" dir="auto">
      <p id="par_id651606319520519" class="tableheadintable" dir="auto">List of Methods in the Array Service</p>
    </th>
  </tr>
  <tr>
    <td rowspan="" colspan="" dir="auto">
      <p id="par_id361606235233835" class="tablecontentintable" dir="auto">
        <a target="_top" href="en-US/text/sbasic/shared/03/sf_array.html#Append">Append</a><br>
        <a target="_top" href="en-US/text/sbasic/shared/03/sf_array.html#AppendColumn">AppendColumn</a><br>
        <a target="_top" href="en-US/text/sbasic/shared/03/sf_array.html#AppendRow">AppendRow</a><br>
        <a target="_top" href="en-US/text/sbasic/shared/03/sf_array.html#Contains">Contains</a><br>
        <a target="_top" href="en-US/text/sbasic/shared/03/sf_array.html#ConvertToDictionary">ConvertToDictionary</a><br>
        <a target="_top" href="en-US/text/sbasic/shared/03/sf_array.html#Copy">Copy</a><br>
        <a target="_top" href="en-US/text/sbasic/shared/03/sf_array.html#CountDims">CountDims</a><br>
        <a target="_top" href="en-US/text/sbasic/shared/03/sf_array.html#Difference">Difference</a><br>
        <a target="_top" href="en-US/text/sbasic/shared/03/sf_array.html#ExportToTextFile">ExportToTextFile</a><br>
        <a target="_top" href="en-US/text/sbasic/shared/03/sf_array.html#ExtractColumn">ExtractColumn</a><br>
        <a target="_top" href="en-US/text/sbasic/shared/03/sf_array.html#ExtractRow">ExtractRow</a><br>
      </p>
    </td>
    <td rowspan="" colspan="" dir="auto">
      <p id="par_id231606235233835" class="tablecontentintable" dir="auto">
        <a target="_top" href="en-US/text/sbasic/shared/03/sf_array.html#Flatten">Flatten</a><br>
        <a target="_top" href="en-US/text/sbasic/shared/03/sf_array.html#ImportFromCSVFile">ImportFromCSVFile</a><br>
        <a target="_top" href="en-US/text/sbasic/shared/03/sf_array.html#IndexOf">IndexOf</a><br>
        <a target="_top" href="en-US/text/sbasic/shared/03/sf_array.html#Insert">Insert</a><br>
        <a target="_top" href="en-US/text/sbasic/shared/03/sf_array.html#InsertSorted">InsertSorted</a><br>
        <a target="_top" href="en-US/text/sbasic/shared/03/sf_array.html#Intersection">Intersection</a><br>
        <a target="_top" href="en-US/text/sbasic/shared/03/sf_array.html#Join2D">Join2D</a><br>
        <a target="_top" href="en-US/text/sbasic/shared/03/sf_array.html#Prepend">Prepend</a><br>
        <a target="_top" href="en-US/text/sbasic/shared/03/sf_array.html#PrependColumn">PrependColumn</a><br>
        <a target="_top" href="en-US/text/sbasic/shared/03/sf_array.html#PrependRow">PrependRow</a><br>
        <a target="_top" href="en-US/text/sbasic/shared/03/sf_array.html#RangeInit">RangeInit</a><br>
      </p>
    </td>
    <td rowspan="" colspan="" dir="auto">
      <p id="par_id831606235233835" class="tablecontentintable" dir="auto">
       <a target="_top" href="en-US/text/sbasic/shared/03/sf_array.html#Reverse">Reverse</a><br>
       <a target="_top" href="en-US/text/sbasic/shared/03/sf_array.html#Shuffle">Shuffle</a><br>
       <a target="_top" href="en-US/text/sbasic/shared/03/sf_array.html#Slice">Slice</a><br>
       <a target="_top" href="en-US/text/sbasic/shared/03/sf_array.html#Sort">Sort</a><br>
       <a target="_top" href="en-US/text/sbasic/shared/03/sf_array.html#SortColumns">SortColumns</a><br>
       <a target="_top" href="en-US/text/sbasic/shared/03/sf_array.html#SortRows">SortRows</a><br>
       <a target="_top" href="en-US/text/sbasic/shared/03/sf_array.html#Transpose">Transpose</a><br>
       <a target="_top" href="en-US/text/sbasic/shared/03/sf_array.html#TrimArray">TrimArray</a><br>
       <a target="_top" href="en-US/text/sbasic/shared/03/sf_array.html#Union">Union</a><br>
       <a target="_top" href="en-US/text/sbasic/shared/03/sf_array.html#Unique">Unique</a><br><br>
      </p>
    </td>
  </tr>
  </table>
<br>
  
  <div class="tip">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/tip.svg" alt="tip" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id191582454485250" dir="auto">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.</p></div>
</div>
<br>

<a name="Append"></a>
  
  <a name="bm_id251582548992953"></a>
    <meta itemprop="keywords" content="Array service,Append">
  
  <h2 id="hd_id151582548992953" dir="auto">Append</h2>
  <p id="par_id931582548992953" class="paragraph" dir="auto">Appends the items listed as arguments to the end of the input array.</p>
  <div class="embedded">
<a name="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Syntax:</h3>
</div>
  <p id="par_id921626975382809" class="paragraph" dir="auto">
    <span class="input" data-tooltip="Click on text to copy to clipboard">svc.Append(array_1d: any[0..*], arg0: any, [arg1: any] ...): any[0..*]</span>
  </p>
  <div class="embedded">
<a name="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parameters:</h3>
</div>
  <p id="par_id471582548992953" class="paragraph" dir="auto"><span class="emph">array_1d</span>: The pre-existing array, may be empty.</p>
  <p id="par_id531582548992953" class="paragraph" dir="auto"><span class="emph">arg0, arg1, ...</span>: Items that will be appended to <span class="literal">array_1d</span>.</p>
  <div class="embedded">
<a name="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Example:</h3>
</div>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    Dim a As Variant
    a = SF_Array.Append(Array(1, 2, 3), 4, 5)
        ' (1, 2, 3, 4, 5)
  </code></pre></div>


<a name="AppendColumn"></a>
  
  <a name="bm_id591582549679172"></a>
    <meta itemprop="keywords" content="Array service,AppendColumn">
  
  <h2 id="hd_id291582549679173" dir="auto">AppendColumn</h2>
  <p id="par_id241582549679173" class="paragraph" dir="auto">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.</p>
  <div class="embedded">
<a name="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Syntax:</h3>
</div>
  <p id="par_id231626975799102" class="paragraph" dir="auto">
    <span class="input" data-tooltip="Click on text to copy to clipboard">svc.AppendColumn(array_2d: any[0..*, 0..*], column: any[0..*]): any[0..*, 0..*]</span>
  </p>
  <div class="embedded">
<a name="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parameters:</h3>
</div>
  <p id="par_id461582549679175" class="paragraph" dir="auto"><span class="emph">array_2d</span>: 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.</p>
  <p id="par_id991582549679175" class="paragraph" dir="auto"><span class="emph">column</span>: A 1-dimensional array with as many items as there are rows in <span class="literal">array_2d</span>.</p>
  <div class="embedded">
<a name="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Example:</h3>
</div>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    Dim a As Variant, b As variant
    a = SF_Array.AppendColumn(Array(1, 2, 3), Array(4, 5, 6))
        ' ((1, 4), (2, 5), (3, 6))
    b = SF_Array.AppendColumn(a, Array(7, 8, 9))
        ' ((1, 4, 7), (2, 5, 8), (3, 6, 9))
    c = SF_Array.AppendColumn(Array(), Array(1, 2, 3))
        ' ∀ i ∈ {0 ≤ i ≤ 2} : b(0, i) ≡ i
  </code></pre></div>


<a name="AppendRow"></a>
  
  <a name="bm_id451582551311490"></a>
    <meta itemprop="keywords" content="Array service,AppendRow">
  
  <h2 id="hd_id751582551333335" dir="auto">AppendRow</h2>
  <p id="par_id941582551396374" class="paragraph" dir="auto">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.</p>
  <div class="embedded">
<a name="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Syntax:</h3>
</div>
  <p id="par_id371626976443125" class="paragraph" dir="auto">
    <span class="input" data-tooltip="Click on text to copy to clipboard">svc.AppendRow(array_2d: any[0..*, 0..*], row: any[0..*]): any[0..*, 0..*])</span>
  </p>
  <div class="embedded">
<a name="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parameters:</h3>
</div>
  <p id="par_id631582551461984" class="paragraph" dir="auto"><span class="emph">array_2d</span>: 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.</p>
  <p id="par_id101582551483685" class="paragraph" dir="auto"><span class="emph">row</span>: A 1-dimensional array with as many items as there are columns in <span class="literal">array_2d</span>.</p>
  <div class="embedded">
<a name="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Example:</h3>
</div>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    Dim a As Variant, b As variant
    a = SF_Array.AppendRow(Array(1, 2, 3), Array(4, 5, 6))
        '  ((1, 2, 3), (4, 5, 6))
    b = SF_Array..AppendRow(Array(), Array(1, 2, 3))
        ' ∀ i ∈ {0 ≤ i ≤ 2} : b(i, 0) ≡ i
  </code></pre></div>


<a name="Contains"></a>
  
  <a name="bm_id521582552517869"></a>
    <meta itemprop="keywords" content="Array service,Contains">
  
  <h2 id="hd_id21582552517870" dir="auto">Contains</h2>
  <p id="par_id391582552517870" class="paragraph" dir="auto">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 (<span class="literal">Empty</span> and <span class="literal">Null</span> 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 <span class="literal">Empty</span> and <span class="literal">Null</span> items are ignored.</p>
  <div class="embedded">
<a name="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Syntax:</h3>
</div>
  <p id="par_id641626976688897" class="paragraph" dir="auto">
    <span class="input" data-tooltip="Click on text to copy to clipboard">svc.Contains(array_1d: any[0..*], tofind: any, casesensitive: bool = False, sortorder: str = ""): bool</span>
  </p>
  <div class="embedded">
<a name="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parameters:</h3>
</div>
  <p id="par_id451582552517871" class="paragraph" dir="auto"><span class="emph">array_1d</span>: The array to scan.</p>
  <p id="par_id221582552517872" class="paragraph" dir="auto"><span class="emph">tofind</span>: A number, a date or a string to find.</p>
  <p id="par_id981582552517872" class="paragraph" dir="auto"><span class="emph">casesensitive</span>: Only for string comparisons (Default = <span class="literal">False</span>).</p>
  <p id="par_id641582553128490" class="paragraph" dir="auto"><span class="emph">sortorder</span>: It can be either "ASC", "DESC" or "" (not sorted). The default value is "".</p>
  <div class="embedded">
<a name="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Example:</h3>
</div>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    Dim a As Variant
    a = SF_Array.Contains(Array("A","B","c","D"), "C", SortOrder := "ASC") ' True
    SF_Array.Contains(Array("A","B","c","D"), "C", CaseSensitive := True) ' False
  </code></pre></div>


<a name="ConvertToDictionary"></a>
  
  <a name="bm_id441582557214489"></a>
    <meta itemprop="keywords" content="Array service,ConvertToDictionary">
  
  <h2 id="hd_id541582557214489" dir="auto">ConvertToDictionary</h2>
    <p id="par_id71582557214489" class="paragraph" dir="auto">Store the content of a 2-columns array into a <a target="_top" href="en-US/text/sbasic/shared/03/sf_dictionary.html">ScriptForge.Dictionary</a> object.
      <br>The key will be extracted from the first column, the item from the second.</p>
  <div class="embedded">
<a name="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Syntax:</h3>
</div>
  <p id="par_id291626977283235" class="paragraph" dir="auto">
    <span class="input" data-tooltip="Click on text to copy to clipboard">svc.ConvertToDictionary(array_2d: any[0..*, 0..1]): obj</span>
  </p>
  <div class="embedded">
<a name="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parameters:</h3>
</div>
  <p id="par_id561582557214489" class="paragraph" dir="auto"><span class="emph">array_2d</span>: Data to be converted into a <span class="literal">ScriptForge.Dictionary</span> object.</p>
  <ul itemprop="Unordered" itemscope="true" itemtype="http://schema.org/ItemList" dir="auto">
    <li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
        <p id="par_id781626977460310" class="listitem" dir="auto">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.</p>
    </li>
    <li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
        <p id="par_id511626977461127" class="listitem" dir="auto">The second column contains the data that will be associated to the corresponding label in the dictionary.</p>
    </li>
  </ul>
  <div class="embedded">
<a name="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Example:</h3>
</div>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    Dim a As Variant, b As Variant
    a = SF_Array.AppendColumn(Array("a", "b", "c"), Array(1, 2, 3))
    b = SF_Array.ConvertToDictionary(a)
    MsgBox b.Item("c") ' 3
  </code></pre></div>


<a name="Copy"></a>
  
  <a name="bm_id251582558126024"></a>
    <meta itemprop="keywords" content="Array service,Copy">
  
  <h2 id="hd_id991627154151529" dir="auto">Copy</h2>
  <p id="par_id571627154604275" class="paragraph" dir="auto">Creates a copy of a 1D or 2D array.</p>
  <div class="embedded">
<a name="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Syntax:</h3>
</div>
  <p id="par_id901627155659667" class="paragraph" dir="auto">
    <span class="input" data-tooltip="Click on text to copy to clipboard">svc.Copy(array_nd: any[0..*]): any[0..*]</span>
  </p>
  <p id="par_id901627155659568" class="paragraph" dir="auto">
    <span class="input" data-tooltip="Click on text to copy to clipboard">svc.Copy(array_nd: any[0..*, 0..*]): any[0..*, 0..*]</span>
  </p>
  <div class="embedded">
<a name="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parameters:</h3>
</div>
  <p id="par_id191627155816815" class="paragraph" dir="auto"><span class="emph">array_nd</span>: The 1D or 2D array to be copied.</p>
  <div class="embedded">
<a name="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Example:</h3>
</div>
  <p id="par_id451627155478940" class="paragraph" dir="auto">A simple assignment of an <span class="literal">Array</span> object will copy its reference instead of creating a copy of the object's contents. See the example below:</p>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    Dim a as Variant, b as Variant
    a = Array(1, 2, 3)
    ' The assignment below is made by reference
    b = a
    ' Hence changing values in "b" will also change "a"
    b(0) = 10
    MsgBox a(0) ' 10
  </code></pre></div>
  <p id="par_id701627155874259" class="paragraph" dir="auto">By using the <span class="literal">Copy</span> method, a copy of the whole <span class="literal">Array</span> object is made. In the example below, <span class="literal">a</span> and <span class="literal">b</span> are different objects and changing values in <span class="literal">b</span> will not affect values in <span class="literal">a</span>.</p>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    Dim a as Variant, b as Variant
    a = Array(1, 2, 3)
    ' Creates a copy of "a" using the "Copy" method
    b = SF_Array.Copy(a)
    b(0) = 10
    MsgBox a(0) ' 1
  </code></pre></div>


<a name="CountDims"></a>
  
  <a name="bm_id251582558126024"></a>
    <meta itemprop="keywords" content="Array service,CountDims">
  
  <h2 id="hd_id761582558126025" dir="auto">CountDims</h2>
  <p id="par_id671582558126025" class="paragraph" dir="auto">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.</p>
  <div class="embedded">
<a name="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Syntax:</h3>
</div>
  <p id="par_id591626977644227" class="paragraph" dir="auto">
    <span class="input" data-tooltip="Click on text to copy to clipboard">svc.CountDims(array_nd: any): int</span>
  </p>
  <div class="embedded">
<a name="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parameters:</h3>
</div>
  <p id="par_id771582558126027" class="paragraph" dir="auto"><span class="emph">array_nd</span>: The array to examine.</p>
  <div class="embedded">
<a name="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Example:</h3>
</div>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    Dim a(1 To 10, -3 To 12, 5)
    MsgBox SF_Array.CountDims(a) ' 3
  </code></pre></div>


<a name="Difference"></a>
  
  <a name="bm_id941582558644286"></a>
    <meta itemprop="keywords" content="Array service,Difference">
  
  <h2 id="hd_id21582558644287" dir="auto">Difference</h2>
  <p id="par_id91582558644287" class="paragraph" dir="auto">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. <span class="literal">Empty</span> and <span class="literal">Null</span> items are forbidden.
      <br>Text comparison can be case sensitive or not.</p>
  <div class="embedded">
<a name="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Syntax:</h3>
</div>
  <p id="par_id311626977822374" class="paragraph" dir="auto">
    <span class="input" data-tooltip="Click on text to copy to clipboard">svc.Difference(array1_1d: any[0..*], array2_1d: any[0..*], casesensitive: bool = False): any[0..*]</span>
  </p>
  <div class="embedded">
<a name="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parameters:</h3>
</div>
  <p id="par_id271582558644287" class="paragraph" dir="auto"><span class="emph">array1_1d</span>: A 1-dimensional reference array, whose items are examined for removal.</p>
  <p id="par_id141582558644287" class="paragraph" dir="auto"><span class="emph">array2_1d</span>: A 1-dimensional array, whose items are subtracted from the first input array.</p>
  <p id="par_id291582559651473" class="paragraph" dir="auto"><span class="emph">casesensitive</span>: This argument is only applicable if the arrays are populated with strings (Default = <span class="literal">False</span>).</p>
  <div class="embedded">
<a name="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Example:</h3>
</div>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    Dim a As Variant
    a = SF_Array.Difference(Array("A", "C", "A", "b", "B"), Array("C", "Z", "b"), True)
        ' ("A", "B")
  </code></pre></div>


<a name="ExportToTextFile"></a>
  
  <a name="bm_iid101582629162107"></a>
    <meta itemprop="keywords" content="Array service,ExportToTextFile">
  
  <h2 id="hd_id231586179707778" dir="auto">ExportToTextFile</h2>
  <p id="par_id941586179707156" class="paragraph" dir="auto">Write all items of the array sequentially to a text file. If the file exists already, it will be overwritten without warning.</p>
  <div class="embedded">
<a name="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Syntax:</h3>
</div>
  <p id="par_id701626978046046" class="paragraph" dir="auto">
    <span class="input" data-tooltip="Click on text to copy to clipboard">svc.ExportToTextFile(array_1d: any[0..*], filename: str, [encoding: str]): bool</span>
  </p>
  <div class="embedded">
<a name="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parameters:</h3>
</div>
  <p id="par_id100158617970719" class="paragraph" dir="auto"><span class="emph">array_1d</span>: The array to export. It must contain only strings.</p>
  <p id="par_id101586179707232" class="paragraph" dir="auto"><span class="emph">filename</span>: The name of the text file where the data will be written to. The name must be expressed according to the current <span class="literal">FileNaming</span> property of the <span class="literal">SF_FileSystem</span> service.</p>
  <p id="par_id70158617970791" class="paragraph" dir="auto"><span class="emph">encoding</span>: The character set that should be used. Use one of the names listed in <a target="_blank" href="https://www.iana.org/assignments/character-sets/character-sets.xhtml">IANA character sets</a>. Note that LibreOffice may not implement all existing character sets (Default is "UTF-8").</p>
  <div class="embedded">
<a name="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Example:</h3>
</div>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    SF_Array.ExportToTextFile(Array("A","B","C","D"), "C:\Temp\A short file.txt")
  </code></pre></div>


<a name="ExtractColumn"></a>
  
  <a name="bm_id891582560281081"></a>
    <meta itemprop="keywords" content="Array service,ExtractColumn">
  
  <h2 id="hd_id721582560281081" dir="auto">ExtractColumn</h2>
  <p id="par_id171582560281082" class="paragraph" dir="auto">Extract from a two dimension array a specific column as a new array.
      <br>Its lower <span class="literal">LBound</span> and upper <span class="literal">UBound</span> boundaries are identical to that of the first dimension of the input array.</p>
  <div class="embedded">
<a name="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Syntax:</h3>
</div>
  <p id="par_id251626978426782" class="paragraph" dir="auto">
    <span class="input" data-tooltip="Click on text to copy to clipboard">svc.ExtractColumn(array_2d: any[0..*, 0..*], columnindex: int): any[0..*, 0..*]</span>
  </p>
  <div class="embedded">
<a name="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parameters:</h3>
</div>
  <p id="par_id301582560281083" class="paragraph" dir="auto"><span class="emph">array_2d</span>: The array from which to extract.</p>
  <p id="par_id421582560281084" class="paragraph" dir="auto"><span class="emph">columnindex</span>: The column number to extract - must be in the interval <span class="literal">[LBound, UBound]</span>.</p>
  <div class="embedded">
<a name="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Example:</h3>
</div>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    'Creates a 3x3 matrix: |1, 2, 3|
    '                      |4, 5, 6|
    '                      |7, 8, 9|
    Dim mat as Variant, col as Variant
    mat = SF_Array.AppendRow(Array(), Array(1, 2, 3))
    mat = SF_Array.AppendRow(mat, Array(4, 5, 6))
    mat = SF_Array.AppendRow(mat, Array(7, 8, 9))
    'Extracts the third column: |3, 6, 9|
    col = SF_Array.ExtractColumn(mat, 2)
  </code></pre></div>


<a name="ExtractRow"></a>
  
  <a name="bm_id891582561395261"></a>
    <meta itemprop="keywords" content="Array service,ExtractRow">
  
  <h2 id="hd_id921582561457245" dir="auto">ExtractRow</h2>
  <p id="par_id211582561467219" class="paragraph" dir="auto">Extract from a two dimension array a specific row as a new array.
      <br>Its lower <span class="literal">LBound</span> and upper <span class="literal">UBound</span> boundaries are identical to that of the second dimension of the input array.</p>
  <div class="embedded">
<a name="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Syntax:</h3>
</div>
  <p id="par_id391626978560113" class="paragraph" dir="auto">
    <span class="input" data-tooltip="Click on text to copy to clipboard">svc.ExtractRow(array_2d: any[0..*, 0..*], rowindex: int): any[0..*, 0..*]</span>
  </p>
  <div class="embedded">
<a name="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parameters:</h3>
</div>
  <p id="par_id911582561542889" class="paragraph" dir="auto"><span class="emph">array_2d</span>: The array from which to extract.</p>
  <p id="par_id441582561551202" class="paragraph" dir="auto"><span class="emph">rowindex</span>: The row number to extract - must be in the interval <span class="literal">[LBound, UBound]</span>.</p>
  <div class="embedded">
<a name="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Example:</h3>
</div>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    'Creates a 3x3 matrix: |1, 2, 3|
    '                      |4, 5, 6|
    '                      |7, 8, 9|
    Dim mat as Variant, row as Variant
    mat = SF_Array.AppendRow(Array(), Array(1, 2, 3))
    mat = SF_Array.AppendRow(mat, Array(4, 5, 6))
    mat = SF_Array.AppendRow(mat, Array(7, 8, 9))
    'Extracts the first row: |1, 2, 3|
    row = SF_Array.ExtractRow(mat, 0)
  </code></pre></div>


<a name="Flatten"></a>
  
  <a name="bm_id261585757822682"></a>
    <meta itemprop="keywords" content="Array service,Flatten">
  
  <h2 id="hd_id351585757822637" dir="auto">Flatten</h2>
  <p id="par_id431585757822181" class="paragraph" dir="auto">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.</p>
  <div class="embedded">
<a name="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Syntax:</h3>
</div>
  <p id="par_id551626978750851" class="paragraph" dir="auto">
    <span class="input" data-tooltip="Click on text to copy to clipboard">svc.Flatten(array_1d: any[0..*]): any[0..*]</span>
  </p>
  <div class="embedded">
<a name="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parameters:</h3>
</div>
  <p id="par_id431585757822869" class="paragraph" dir="auto"><span class="emph">array_1d</span>: The pre-existing array, may be empty.</p>
  <div class="embedded">
<a name="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Example:</h3>
</div>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    Dim a As Variant
    a = SF_Array.Flatten(Array(Array(1, 2, 3), 4, 5))
        ' (1, 2, 3, 4, 5)
  </code></pre></div>
  <div class="tip">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/tip.svg" alt="tip" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id291610040786530" dir="auto">You can use the <span class="literal">Flatten</span> method along with other methods such as <span class="literal">Append</span> or <span class="literal">Prepend</span> to concatenate a set of 1D arrays into a single 1D array.</p></div>
</div>
<br>
  <div class="embedded">
<a name="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Example:</h3>
</div>
  <p id="par_id941610040961148" class="paragraph" dir="auto">Next is an example of how the methods <span class="literal">Flatten</span> and <span class="literal">Append</span> can be combined to concatenate three arrays.</p>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    'Creates three arrays for this example
    Dim a as Variant, b as Variant, c as Variant
    a = Array(1, 2, 3)
    b = Array(4, 5)
    c = Array(6, 7, 8, 9)
    'Concatenates the three arrays into a single 1D array
    Dim arr as Variant
    arr = SF_Array.Flatten(SF_Array.Append(a, b, c))
    '(1, 2, 3, 4, 5, 6, 7, 8, 9)
  </code></pre></div>


<a name="ImportFromCSVFile"></a>
  
  <a name="bm_iid101582629162107"></a>
    <meta itemprop="keywords" content="Array service,ImportFromCSVFile">
  
  <h2 id="hd_id581585561482142" dir="auto">ImportFromCSVFile</h2>
  <p id="par_id611585561482373" class="paragraph" dir="auto">Import the data contained in a comma-separated values (CSV) file. The comma may be replaced by any character.</p>
  <p id="par_id41585562158392" class="paragraph" dir="auto">The applicable CSV format is described in <a target="_blank" href="https://tools.ietf.org/html/rfc4180">IETF Common Format and MIME Type for CSV Files</a>.</p>
  <p id="par_id641585562341028" class="paragraph" dir="auto">Each line in the file contains a full record (line splitting is not allowed).
     <br>However sequences like <span class="literal">\n</span>, <span class="literal">\t</span>, ... are left unchanged. Use <span class="literal">SF_String</span>.Unescape() method to manage them.</p>
  <p id="par_id231585562475026" class="paragraph" dir="auto">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.</p>
  <p id="par_id101585562548245" class="paragraph" dir="auto">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.</p>
  <div class="embedded">
<a name="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Syntax:</h3>
</div>
  <p id="par_id121626979017138" class="paragraph" dir="auto">
    <span class="input" data-tooltip="Click on text to copy to clipboard">svc.ImportFromCSVFile(filename: str, delimiter: str = ',', dateformat: str = ''): any[0..*]</span>
  </p>
  <div class="embedded">
<a name="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parameters:</h3>
</div>
  <p id="par_id441585561482121" class="paragraph" dir="auto"><span class="emph">filename</span>: The name of the text file containing the data. The name must be expressed according to the current <span class="literal">FileNaming</span> property of the <span class="literal">SF_FileSystem</span> service.</p>
  <p id="par_id251585561482929" class="paragraph" dir="auto"><span class="emph">delimiter</span>: A single character, usually, a comma, a semicolon or a TAB character (Default = ",").</p>
  <p id="par_id631585563491559" class="paragraph" dir="auto"><span class="emph">dateformat</span>: A special mechanism handles dates when <span class="literal">dateformat</span> 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.</p>
  <div class="embedded">
<a name="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Example:</h3>
</div>
  <p id="par_id61585564516409" class="paragraph" dir="auto">Consider the CSV file "myFile.csv" with the following contents:</p>
  <p id="par_id281626980354105" class="paragraph" dir="auto"><span class="input" data-tooltip="Click on text to copy to clipboard">Name,DateOfBirth,Address,City</span></p>
  <p id="par_id301626980648833" class="paragraph" dir="auto"><span class="input" data-tooltip="Click on text to copy to clipboard">Anna,2002/03/31,"Rue de l'église, 21",Toulouse</span></p>
  <p id="par_id881626980658900" class="paragraph" dir="auto"><span class="input" data-tooltip="Click on text to copy to clipboard">Fred,1998/05/04,"Rue Albert Einstein, 113A",Carcassonne</span></p>
  <p id="par_id181626979812772" class="paragraph" dir="auto">The examples below in Basic and Python read the contents of the CSV file into an <span class="literal">Array</span> object.</p>
  <div class="embedded">
<a name="In_Basic"></a>
<h5 id="hd_id191620312698501" dir="auto">In Basic</h5>
</div>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    Dim arr As Variant
    arr = SF_Array.ImportFromCSVFile("C:\Temp\myFile.csv", DateFormat := "YYYY/MM/DD")
    MsgBox arr(0, 3) ' City
    MsgBox arr(1, 2) ' Rue de l'église, 21
    MsgBox arr(1, 3) ' Toulouse
  </code></pre></div>
  <div class="embedded">
<a name="In_Python"></a>
<h5 id="hd_id831620312769993" dir="auto">In Python</h5>
</div>
  <div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-python line-numbers">
    from scriptforge import CreateScriptService
    svc = CreateScriptService("Array")
    bas = CreateScriptService("Basic")
    arr = svc.ImportFromCSVFile(r"C:\Temp\myFile.csv", dateformat = "YYYY/MM/DD")
    bas.MsgBox(arr[0][3]) # City
    bas.MsgBox(arr[1][2]) # Rue de l'église, 21
    bas.MsgBox(arr[1][3]) # Toulouse
  </code></pre></div>


<a name="IndexOf"></a>
  
  <a name="bm_id361582562709465"></a>
    <meta itemprop="keywords" content="Array service,IndexOf">
  
  <h2 id="hd_id741582562715741" dir="auto">IndexOf</h2>
  <p id="par_id211582562721860" class="paragraph" dir="auto">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 (<span class="literal">Empty</span> and <span class="literal">Null</span> 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 <span class="literal">Empty</span> and <span class="literal">Null</span> items are ignored.
      <br>
      <br>The method returns <span class="literal">LBound(input array) - 1</span> if the search was not successful.</p>
  <div class="embedded">
<a name="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Syntax:</h3>
</div>
  <p id="par_id741626980743030" class="paragraph" dir="auto">
    <span class="input" data-tooltip="Click on text to copy to clipboard">svc.IndexOf(array_1d: any[0..*], tofind: any, casesensitive: bool = False, sortorder: str = ''): int</span>
  </p>
  <div class="embedded">
<a name="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parameters:</h3>
</div>
  <p id="par_id315825627687760" class="paragraph" dir="auto"><span class="emph">array_1d</span>: The array to scan.</p>
  <p id="par_id511582562775516" class="paragraph" dir="auto"><span class="emph">tofind</span>: A number, a date or a string to find.</p>
  <p id="par_id311582562787187" class="paragraph" dir="auto"><span class="emph">casesensitive</span>: Only for string comparisons (Default = <span class="literal">False</span>).</p>
  <p id="par_id421582562794501" class="paragraph" dir="auto"><span class="emph">sortorder</span>: It can be either "ASC", "DESC" or "" (not sorted). The default value is "".</p>
  <div class="embedded">
<a name="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Example:</h3>
</div>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    MsgBox SF_Array.IndexOf(Array("A","B","c","D"), "C", SortOrder := "ASC") ' 2
    MsgBox SF_Array.IndexOf(Array("A","B","c","D"), "C", CaseSensitive := True) ' -1
  </code></pre></div>


<a name="Insert"></a>
  
  <a name="bm_id371582626951108"></a>
    <meta itemprop="keywords" content="Array service,Insert">
  
  <h2 id="hd_id101582626951109" dir="auto">Insert</h2>
  <p id="par_id911582626951109" class="paragraph" dir="auto">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.</p>
  <div class="embedded">
<a name="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Syntax:</h3>
</div>
  <p id="par_id701626981031599" class="paragraph" dir="auto">
    <span class="input" data-tooltip="Click on text to copy to clipboard">svc.Insert(array_1d: any[0..*], before: int, arg0: any, [arg1: any] ...): any[0..*]</span>
  </p>
  <div class="embedded">
<a name="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parameters:</h3>
</div>
  <p id="par_id251582626951111" class="paragraph" dir="auto"><span class="emph">array_1d</span>: The pre-existing array, may be empty.</p>
  <p id="par_id361582626951111" class="paragraph" dir="auto"><span class="emph">before</span>: The index before which to insert; must be in the interval <span class="literal">[LBound, UBound + 1]</span>.</p>
  <p id="par_id41582626951111" class="paragraph" dir="auto"><span class="emph">arg0, arg1, ...</span>: Items that will be inserted into <span class="literal">array_1d</span>.</p>
  <div class="embedded">
<a name="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Example:</h3>
</div>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    Dim a As Variant
    a = SF_Array.Insert(Array(1, 2, 3), 2, "a", "b")
        ' (1, 2, "a", "b", 3)
  </code></pre></div>


<a name="InsertSorted"></a>
  
  <a name="bm_id311582627664147"></a>
    <meta itemprop="keywords" content="Array service,InsertSorted">
  
  <h2 id="hd_id981582627664147" dir="auto">InsertSorted</h2>
  <p id="par_id441582627664147" class="paragraph" dir="auto">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><span class="literal">Empty</span> and <span class="literal">Null</span> items are forbidden.</p>
  <div class="embedded">
<a name="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Syntax:</h3>
</div>
  <p id="par_id561626981419647" class="paragraph" dir="auto">
    <span class="input" data-tooltip="Click on text to copy to clipboard">svc.InsertSorted(array_1d: any[0..*], item: any, sortorder: str = 'ASC', casesensitive: bool = False): any[0..*]</span>
  </p>
  <div class="embedded">
<a name="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parameters:</h3>
</div>
  <p id="par_id121582627664147" class="paragraph" dir="auto"><span class="emph">array_1d</span>: The array into which the value will be inserted.</p>
  <p id="par_id315826276641480" class="paragraph" dir="auto"><span class="emph">item</span>: The scalar value to insert, of the same type as the existing array items.</p>
  <p id="par_id415826279771170" class="paragraph" dir="auto"><span class="emph">sortorder</span>: It can be either "ASC" (default) or "DESC".</p>
  <p id="par_id701582627970037" class="paragraph" dir="auto"><span class="emph">casesensitive</span>: Only for string comparisons (Default = <span class="literal">False</span>).</p>
  <div class="embedded">
<a name="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Example:</h3>
</div>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    Dim a As Variant
    a = SF_Array.InsertSorted(Array("A", "C", "a", "b"), "B", CaseSensitive := True)
        ' ("A", "B", "C", "a", "b")
  </code></pre></div>


<a name="Intersection"></a>
  
  <a name="bm_iid101582629162107"></a>
    <meta itemprop="keywords" content="Array service,Intersection">
  
  <h2 id="hd_id841582629169550" dir="auto">Intersection</h2>
  <p id="par_id71582629177169" class="paragraph" dir="auto">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. <span class="literal">Empty</span> and <span class="literal">Null</span> items are forbidden.
      <br>Text comparison can be case sensitive or not.</p>
  <div class="embedded">
<a name="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Syntax:</h3>
</div>
  <p id="par_id91626981727462" class="paragraph" dir="auto">
    <span class="input" data-tooltip="Click on text to copy to clipboard">svc.Intersection(array1_1d: any[0..*], array2_1d: any[0..*], casesensitive: bool = False): any[0..*]</span>
  </p>
  <div class="embedded">
<a name="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parameters:</h3>
</div>
  <p id="par_id881582629216169" class="paragraph" dir="auto"><span class="emph">array1_1d</span>: The first input array.</p>
  <p id="par_id191582629223038" class="paragraph" dir="auto"><span class="emph">array2_1d</span>: The second input array.</p>
  <p id="par_id71582629230275" class="paragraph" dir="auto"><span class="emph">casesensitive</span>: Applies to arrays populated with text items (Default = <span class="literal">False</span>).</p>
  <div class="embedded">
<a name="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Example:</h3>
</div>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    Dim a As Variant
    a = SF_Array.Intersection(Array("A", "C", "A", "b", "B"), Array("C", "Z", "b"), True)
        ' ("C", "b")
  </code></pre></div>


<a name="Join2D"></a>
  
  <a name="bm_id231583064481294"></a>
    <meta itemprop="keywords" content="Array service,Join2D">
  
  <h2 id="hd_id641583064481282" dir="auto">Join2D</h2>
  <p id="par_id431583064481679" class="paragraph" dir="auto">Join a two-dimensional array with two delimiters, one for the columns, one for the rows.</p>
  <div class="embedded">
<a name="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Syntax:</h3>
</div>
  <p id="par_id421626982116561" class="paragraph" dir="auto">
    <span class="input" data-tooltip="Click on text to copy to clipboard">svc.Join2D(array_2d: any [0..*, 0..*], [columndelimiter: str], [rowdelimiter: str], [quote: str]): str</span>
  </p>
  <div class="embedded">
<a name="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parameters:</h3>
</div>
  <p id="par_id821583064481534" class="paragraph" dir="auto"><span class="emph">array_2d</span>: Each item must be either text, a number, a date or a boolean.
      <br>Dates are transformed into the YYYY-MM-DD hh:mm:ss format.
      <br>Invalid items are replaced by a zero-length string.</p>
  <p id="par_id171583066989446" class="paragraph" dir="auto"><span class="emph">columndelimiter</span>: Delimits each column (default = Tab/Chr(9)).</p>
  <p id="par_id431583067008842" class="paragraph" dir="auto"><span class="emph">rowdelimiter</span>: Delimits each row (default = LineFeed/Chr(10))</p>
  <p id="par_id541583067456273" class="paragraph" dir="auto"><span class="emph">quote</span>: If <span class="literal">True</span>, protect strings with double quotes. The default is <span class="literal">False</span>.</p>
  <div class="embedded">
<a name="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Example:</h3>
</div>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    ' arr = | 1, 2, "A", [2020-02-29], 51, 2, "A", [2020-02-29], 5           |
    '       | 6, 7, "this is a string", 9, 106, 7, "this is a string", 9, 10 |
    Dim arr as Variant : arr = Array()
    arr = SF_Array.AppendRow(arr, Array(1, 2, "A", [2020-02-29], 51, 2, "A", [2020-02-29], 5))
    arr = SF_Array.AppendRow(arr, Array(6, 7, "this is a string", 9, 106, 7, "this is a string", 9, 10))
    Dim arrText as String
    arrText = SF_Array.Join2D(arr, ",", "/", False)
    ' 1,2,A,,51,2,A,,5/6,7,this is a string,9,106,7,this is a string,9,10
  </code></pre></div>


<a name="Prepend"></a>
  
  <a name="bm_id701582629972724"></a>
    <meta itemprop="keywords" content="Array service,Prepend">
  
  <h2 id="hd_id931582629986047" dir="auto">Prepend</h2>
  <p id="par_id731582630075045" class="paragraph" dir="auto">Prepend at the beginning of the input array the items listed as arguments.</p>
  <div class="embedded">
<a name="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Syntax:</h3>
</div>
  <p id="par_id281626997292148" class="paragraph" dir="auto">
    <span class="input" data-tooltip="Click on text to copy to clipboard">svc.Prepend(array_1d: any[0..*], arg0: any, [arg1: any] ...): any[0..*]</span>
  </p>
  <div class="embedded">
<a name="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parameters:</h3>
</div>
  <p id="par_id321582630107068" class="paragraph" dir="auto"><span class="emph">array_1d</span>: The pre-existing array, may be empty.</p>
  <p id="par_id915826301138550" class="paragraph" dir="auto"><span class="emph">arg0, arg1, ...</span>: A list of items to prepend to <span class="literal">array_1d</span>.</p>
  <div class="embedded">
<a name="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Example:</h3>
</div>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    Dim a As Variant
    a = SF_Array.Prepend(Array(1, 2, 3), 4, 5)
        ' (4, 5, 1, 2, 3)
  </code></pre></div>


<a name="PrependColumn"></a>
  
  <a name="bm_id211582643223924"></a>
    <meta itemprop="keywords" content="Array service,PrependColumn">
  
  <h2 id="hd_id25158264322311" dir="auto">PrependColumn</h2>
  <p id="par_id91582643223166" class="paragraph" dir="auto">Prepend to the left side of a two dimension array a new column. The resulting array has the same lower boundaries as the initial two dimension array.</p>
  <div class="embedded">
<a name="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Syntax:</h3>
</div>
  <p id="par_id601626997478388" class="paragraph" dir="auto">
    <span class="input" data-tooltip="Click on text to copy to clipboard">svc.PrependColumn(array_2d: any[0..*, 0..*], column: any[0..*]): any[0..*, 0..*]</span>
  </p>
  <div class="embedded">
<a name="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parameters:</h3>
</div>
  <p id="par_id621582643223545" class="paragraph" dir="auto"><span class="emph">array_2d</span>: The pre-existing array, may be empty. If that array has 1 dimension, it is considered as the last column of the resulting 2 dimension array.</p>
  <p id="par_id381582643223870" class="paragraph" dir="auto"><span class="emph">column</span>: A 1-dimensional array with as many items as there are rows in <span class="literal">array_2d</span>.</p>
  <div class="embedded">
<a name="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Example:</h3>
</div>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    Dim a As Variant, b As variant
    a = SF_Array.PrependColumn(Array(1, 2, 3), Array(4, 5, 6))
        ' ((4, 1), (5, 2), (6, 3))
    b = SF_Array.PrependColumn(Array(), Array(1, 2, 3))
        ' ∀ i ∈ {0 ≤ i ≤ 2} : b(0, i) ≡ i
  </code></pre></div>


<a name="PrependRow"></a>
  
  <a name="bm_id321582643611165"></a>
    <meta itemprop="keywords" content="Array service,PrependRow">
  
  <h2 id="hd_id921582643611272" dir="auto">PrependRow</h2>
  <p id="par_id851582643611291" class="paragraph" dir="auto">Prepend a new row at the beginning of a 2-dimensional array. The resulting array has the same lower boundaries as the initial 2-dimensional array.</p>
  <div class="embedded">
<a name="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Syntax:</h3>
</div>
  <p id="par_id791626997749524" class="paragraph" dir="auto">
    <span class="input" data-tooltip="Click on text to copy to clipboard">svc.PrependRow(array_2d: any[0..*, 0..*], row: any[0..*]): any[0..*, 0..*]</span>
  </p>
  <div class="embedded">
<a name="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parameters:</h3>
</div>
  <p id="par_id991582643611645" class="paragraph" dir="auto"><span class="emph">array_2d</span>: The pre-existing array, may be empty. If that array has 1 dimension, it is considered as the last row of the resulting 2-dimensional array.</p>
  <p id="par_id321582643611415" class="paragraph" dir="auto"><span class="emph">row</span>: A 1-dimensional array containing as many items as there are columns in <span class="literal">array_2d</span>.</p>
  <div class="embedded">
<a name="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Example:</h3>
</div>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    Dim a As Variant, b As variant
    a = SF_Array.PrependRow(Array(1, 2, 3), Array(4, 5, 6))
        ' ((4, 5, 6), (1, 2, 3))
    b = SF_Array.PrependRow(Array(), Array(1, 2, 3))
        ' ∀ i ∈ {0 ≤ i ≤ 2} : b(i, 0) ≡ i
  </code></pre></div>


<a name="RangeInit"></a>
  
  <a name="bm_id321582648204011"></a>
    <meta itemprop="keywords" content="Array service,RangeInit">
  
  <h2 id="hd_id61582648204011" dir="auto">RangeInit</h2>
  <p id="par_id441582648204012" class="paragraph" dir="auto">Initialize a new zero-based array with numeric values.</p>
  <div class="embedded">
<a name="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Syntax:</h3>
</div>
  <p id="par_id851626997928653" class="paragraph" dir="auto">
    <span class="input" data-tooltip="Click on text to copy to clipboard">svc.RangeInit(from: num, upto: num, [bystep: num]): num[0..*]</span>
  </p>
  <div class="embedded">
<a name="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parameters:</h3>
</div>
  <p id="par_id591582648204013" class="paragraph" dir="auto"><span class="emph">from</span>: Value of the first item.</p>
  <p id="par_id31582648204013" class="paragraph" dir="auto"><span class="emph">upto</span>: The last item should not exceed <span class="literal">UpTo</span>.</p>
  <p id="par_id581582648204014" class="paragraph" dir="auto"><span class="emph">bystep</span>: The difference between two successive items (Default = 1).</p>
  <div class="embedded">
<a name="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Example:</h3>
</div>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    Dim a As Variant
    a = SF_Array.RangeInit(10, 1, -1)
        ' (10, 9, 8, 7, 6, 5, 4, 3, 2, 1)
  </code></pre></div>


<a name="Reverse"></a>
  
  <a name="bm_id31582648806764"></a>
    <meta itemprop="keywords" content="Array service,Reverse">
  
  <h2 id="hd_id111582648806764" dir="auto">Reverse</h2>
  <p id="par_id451582648806764" class="paragraph" dir="auto">Return the reversed one dimension input array.</p>
  <div class="embedded">
<a name="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Syntax:</h3>
</div>
  <p id="par_id71626998176865" class="paragraph" dir="auto">
    <span class="input" data-tooltip="Click on text to copy to clipboard">svc.Reverse(array_1d: any[0..*]): any[0..*]</span>
  </p>
  <div class="embedded">
<a name="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parameters:</h3>
</div>
  <p id="par_id31582648806765" class="paragraph" dir="auto"><span class="emph">array_1d</span>: The array to reverse.</p>
  <div class="embedded">
<a name="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Example:</h3>
</div>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    Dim a As Variant
    a = SF_Array.Reverse(Array("a", 2, 3, 4))
        ' (4, 3, 2, "a")
  </code></pre></div>


<a name="Shuffle"></a>
  
  <a name="bm_id531582649200087"></a>
    <meta itemprop="keywords" content="Array service,Shuffle">
  
  <h2 id="hd_id731582649200088" dir="auto">Shuffle</h2>
  <p id="par_id151582649200088" class="paragraph" dir="auto">Returns a random permutation of a one-dimensional array.</p>
  <div class="embedded">
<a name="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Syntax:</h3>
</div>
  <p id="par_id191626998317797" class="paragraph" dir="auto">
    <span class="input" data-tooltip="Click on text to copy to clipboard">svc.Shuffle(array_1d: any[0..*]): any[0..*]</span>
  </p>
  <div class="embedded">
<a name="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parameters:</h3>
</div>
  <p id="par_id11582649200088" class="paragraph" dir="auto"><span class="emph">array_1d</span>: The array to shuffle.</p>
  <div class="embedded">
<a name="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Example:</h3>
</div>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    Dim a As Variant
    a = SF_Array.Shuffle(Array(1, 2, 3, 4))
        ' Array "a" is now in random order, f.i. (2, 3, 1, 4)
  </code></pre></div>


<a name="Slice"></a>
  
  <a name="bm_id20158618418514"></a>
    <meta itemprop="keywords" content="Array service,Slice">
  
  <h2 id="hd_id281586184185623" dir="auto">Slice</h2>
  <p id="par_id111586184185502" class="paragraph" dir="auto">Returns a subset of a one-dimensional array.</p>
  <div class="embedded">
<a name="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Syntax:</h3>
</div>
  <p id="par_id801626998508832" class="paragraph" dir="auto">
    <span class="input" data-tooltip="Click on text to copy to clipboard">svc.Slice(array_1d: any[0..*], from: int, [upto: int]): any[0..*]</span>
  </p>
  <div class="embedded">
<a name="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parameters:</h3>
</div>
  <p id="par_id201586184185438" class="paragraph" dir="auto"><span class="emph">array_1d</span>: The array to slice.</p>
  <p id="par_id921586184482370" class="paragraph" dir="auto"><span class="emph">from</span>: The lower index in <span class="literal">array_1d</span> of the subarray to extract (<span class="literal">from</span> included)</p>
  <p id="par_id211586184471488" class="paragraph" dir="auto"><span class="emph">upto</span>: The upper index in <span class="literal">array_1d</span> of the subarray to extract (<span class="literal">upto</span> included). The default value is the upper bound of <span class="literal">array_1d</span>. If <span class="literal">upto</span> &lt; <span class="literal">from</span> then the returned array is empty.</p>
  <div class="embedded">
<a name="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Example:</h3>
</div>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    Dim a As Variant
    a = SF_Array.Slice(Array(1, 2, 3, 4, 5), 1, 3) ' (2, 3, 4)
  </code></pre></div>


<a name="Sort"></a>
  
  <a name="bm_id561582649483854"></a>
    <meta itemprop="keywords" content="Array service,Sort">
  
  <h2 id="hd_id65158264948384" dir="auto">Sort</h2>
  <p id="par_id171582649483675" class="paragraph" dir="auto">Sort a one dimension array in ascending or descending order. Text comparisons can be case-sensitive or not.
      <br>The array must be filled homogeneously, which means that items must be scalars of the same type.
      <br><span class="literal">Empty</span> and <span class="literal">Null</span> items are allowed. Conventionally <span class="literal">Empty</span> &lt; <span class="literal">Null</span> &lt; any other scalar value.</p>
  <div class="embedded">
<a name="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Syntax:</h3>
</div>
  <p id="par_id711626998747838" class="paragraph" dir="auto">
    <span class="input" data-tooltip="Click on text to copy to clipboard">svc.Sort(array_1d: any[0..*], sortorder: str, casesensitive: bool = False): any[0..*]</span>
  </p>
  <div class="embedded">
<a name="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parameters:</h3>
</div>
  <p id="par_id71158264948346" class="paragraph" dir="auto"><span class="emph">array_1d</span>: The array to sort.</p>
  <p id="par_id21582649483175" class="paragraph" dir="auto"><span class="emph">sortorder</span>: It can be either "ASC" (default) or "DESC".</p>
  <p id="par_id301582649483187" class="paragraph" dir="auto"><span class="emph">casesensitive</span>: Only for string comparisons (Default = <span class="literal">False</span>).</p>
  <div class="embedded">
<a name="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Example:</h3>
</div>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    Dim a As Variant
    a = SF_Array.Sort(Array("a", "A", "b", "B", "C"), CaseSensitive := True)
        ' ("A", "B", "C", "a", "b")
  </code></pre></div>


<a name="SortColumns"></a>
  
  <a name="bm_id51582650186361"></a>
    <meta itemprop="keywords" content="Array service,SortColumns">
  
  <h2 id="hd_id20158265018616" dir="auto">SortColumns</h2>
  <p id="par_id801582650186957" class="paragraph" dir="auto">Return a permutation of the columns of a two dimension array, sorted on the values of a given row.
      <br>The row must be filled homogeneously, which means that all items must be scalars of the same type.
      <br><span class="literal">Empty</span> and <span class="literal">Null</span> items are allowed. Conventionally <span class="literal">Empty</span> &lt; <span class="literal">Null</span> &lt; any other scalar value.</p>
  <div class="embedded">
<a name="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Syntax:</h3>
</div>
  <p id="par_id301626998975171" class="paragraph" dir="auto">
    <span class="input" data-tooltip="Click on text to copy to clipboard">svc.SortColumns(array_2d: any[0..*, 0..*], rowindex: int, sortorder: str, casesensitive: bool = False): any[0..*, 0..*]</span>
  </p>
  <div class="embedded">
<a name="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parameters:</h3>
</div>
  <p id="par_id921582650186869" class="paragraph" dir="auto"><span class="emph">array_2d</span>: The 2-dimensional array to sort.</p>
  <p id="par_id311582650186221" class="paragraph" dir="auto"><span class="emph">rowindex</span>: The index of the row that will be used as reference to sort the columns.</p>
  <p id="par_id34158265018698" class="paragraph" dir="auto"><span class="emph">sortorder</span>: It can be either "ASC" (default) or "DESC".</p>
  <p id="par_id91158265018699" class="paragraph" dir="auto"><span class="emph">casesensitive</span>: Only for string comparisons (Default = <span class="literal">False</span>).</p>
  <div class="embedded">
<a name="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Example:</h3>
</div>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    ' arr = | 5, 7, 3 |
    '       | 1, 9, 5 |
    '       | 6, 1, 8 |
    Dim arr as Variant : arr = Array(5, 7, 3)
    arr = SF_Array.AppendRow(arr, Array(1, 9, 5))
    arr = SF_Array.AppendRow(arr, Array(6, 1, 8))
    arr = SF_Array.SortColumns(arr, 2, "ASC")
    ' arr = | 7, 5, 3 |
    '       | 9, 1, 5 |
    '       | 1, 6, 8 |
  </code></pre></div>


<a name="SortRows"></a>
  
  <a name="bm_id301582650954674"></a>
    <meta itemprop="keywords" content="Array service,SortRows">
  
  <h2 id="hd_id951582650954980" dir="auto">SortRows</h2>
  <p id="par_id751582650954576" class="paragraph" dir="auto">Return a permutation of the rows of a two dimension array, sorted on the values of a given column.
      <br>The column must be filled homogeneously, therefore all items must be scalars of the same type.
      <br><span class="literal">Empty</span> and <span class="literal">Null</span> items are allowed. Conventionally <span class="literal">Empty</span> &lt; <span class="literal">Null</span> &lt; any other scalar value.</p>
  <div class="embedded">
<a name="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Syntax:</h3>
</div>
  <p id="par_id681626999672323" class="paragraph" dir="auto">
    <span class="input" data-tooltip="Click on text to copy to clipboard">svc.SortRows(array_2d: any[0..*, 0..*], columnindex: int, sortorder: str, casesensitive: bool = False): any[0..*, 0..*]</span>
  </p>
  <div class="embedded">
<a name="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parameters:</h3>
</div>
  <p id="par_id621582650954370" class="paragraph" dir="auto"><span class="emph">array_2d</span>: The array to sort.</p>
  <p id="par_id361582650954796" class="paragraph" dir="auto"><span class="emph">columnindex</span>: The index of the column that will be used as reference to sort the rows.</p>
  <p id="par_id471582650954416" class="paragraph" dir="auto"><span class="emph">sortorder</span>: It can be either "ASC" (default) or "DESC".</p>
  <p id="par_id111582650954690" class="paragraph" dir="auto"><span class="emph">casesensitive</span>: Only for string comparisons (Default = <span class="literal">False</span>).</p>
  <div class="embedded">
<a name="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Example:</h3>
</div>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    ' arr = | 5, 7, 3 |
    '       | 1, 9, 5 |
    '       | 6, 1, 8 |
    Dim arr as Variant : arr = Array(5, 7, 3)
    arr = SF_Array.AppendRow(arr, Array(1, 9, 5))
    arr = SF_Array.AppendRow(arr, Array(6, 1, 8))
    arr = SF_Array.SortRows(arr, 0, "ASC")
    ' arr = | 1, 9, 5 |
    '       | 5, 7, 3 |
    '       | 6, 1, 8 |
  </code></pre></div>


<a name="Transpose"></a>
  
  <a name="bm_id591582651575793"></a>
    <meta itemprop="keywords" content="Array service,Transpose">
  
  <h2 id="hd_id671582651575799" dir="auto">Transpose</h2>
  <p id="par_id611582651575637" class="paragraph" dir="auto">Swaps rows and columns in a two-dimensional array.</p>
  <div class="embedded">
<a name="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Syntax:</h3>
</div>
  <p id="par_id561627065272658" class="paragraph" dir="auto">
    <span class="input" data-tooltip="Click on text to copy to clipboard">svc.Transpose(array_2d: any[0..*, 0..*]): any[0..*, 0..*]</span>
  </p>
  <div class="embedded">
<a name="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parameters:</h3>
</div>
  <p id="par_id61582651575188" class="paragraph" dir="auto"><span class="emph">array_2d</span>: The 2-dimensional array to transpose.</p>
  <div class="embedded">
<a name="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Example:</h3>
</div>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    ' arr1 = | 1, 2 |
    '        | 3, 4 |
    '        | 5, 6 |
    arr1 = Array(1, 2)
    arr1 = SF_Array.AppendRow(arr1, Array(3, 4))
    arr1 = SF_Array.AppendRow(arr1, Array(5, 6))
    arr2 = SF_Array.Transpose(arr1)
    ' arr2 = | 1, 3, 5 |
    '        | 2, 4, 6 |
    MsgBox arr2(0, 2) ' 5
  </code></pre></div>


<a name="TrimArray"></a>
  
  <a name="bm_id501582652996740"></a>
    <meta itemprop="keywords" content="Array service,TrimArray">
  
  <h2 id="hd_id27158265299667" dir="auto">TrimArray</h2>
  <p id="par_id181582652996483" class="paragraph" dir="auto">Remove from a one dimension array all <span class="literal">Null</span>, <span class="literal">Empty</span> and zero-length entries.
      <br>String items are trimmed with LibreOffice Basic <span class="literal">Trim()</span> function.</p>
  <div class="embedded">
<a name="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Syntax:</h3>
</div>
  <p id="par_id151627066407801" class="paragraph" dir="auto">
    <span class="input" data-tooltip="Click on text to copy to clipboard">svc.TrimArray(array_1d: any[0..*]): any[0..*]</span>
  </p>
  <div class="embedded">
<a name="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parameters:</h3>
</div>
  <p id="par_id111582652996147" class="paragraph" dir="auto"><span class="emph">array_1d</span>: The array to trim.</p>
  <div class="embedded">
<a name="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Example:</h3>
</div>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    Dim a As Variant
    a = SF_Array.TrimArray(Array("A", "B", Null, " D "))
        ' ("A", "B", "D")
  </code></pre></div>


<a name="Union"></a>
  
  <a name="bm_iid101582629162107"></a>
    <meta itemprop="keywords" content="Array service,Union">
  
  <h2 id="hd_id341582653148202" dir="auto">Union</h2>
  <p id="par_id461582653148663" class="paragraph" dir="auto">Builds a set, as a zero-based array, by applying the union operator on the two input arrays. Resulting items originate from any of both arrays.
      <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. <span class="literal">Empty</span> and <span class="literal">Null</span> items are forbidden.
      <br>Text comparison can be case sensitive or not.</p>
  <div class="embedded">
<a name="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Syntax:</h3>
</div>
  <p id="par_id631627066696377" class="paragraph" dir="auto">
    <span class="input" data-tooltip="Click on text to copy to clipboard">svc.Union(array1_1d: any[0..*], array2_1d: any[0..*], casesensitive: bool = False): any[0..*]</span>
  </p>
  <div class="embedded">
<a name="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parameters:</h3>
</div>
  <p id="par_id4715826531488" class="paragraph" dir="auto"><span class="emph">array1_1d</span>: The first input array.</p>
  <p id="par_id51158265314898" class="paragraph" dir="auto"><span class="emph">array2_1d</span>: The second input array.</p>
  <p id="par_id821582653148126" class="paragraph" dir="auto"><span class="emph">casesensitive</span>: Applicable only if the arrays are populated with strings (Default = <span class="literal">False</span>).</p>
  <div class="embedded">
<a name="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Example:</h3>
</div>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    Dim a As Variant
    a = SF_Array.Union(Array("A", "C", "A", "b", "B"), Array("C", "Z", "b"), True)
        ' ("A", "B", "C", "Z", "b")
  </code></pre></div>


<a name="Unique"></a>
  
  <a name="bm_iid101582629162107"></a>
    <meta itemprop="keywords" content="Array service,Unique">
  
  <h2 id="hd_id141582653464997" dir="auto">Unique</h2>
  <p id="par_id221582653464565" class="paragraph" dir="auto">Build a set of unique values derived from the input array.
      <br>The input array must be filled homogeneously, its items must be scalars of the same type. <span class="literal">Empty</span> and <span class="literal">Null</span> items are forbidden.
      <br>Text comparison can be case sensitive or not.</p>
  <div class="embedded">
<a name="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Syntax:</h3>
</div>
  <p id="par_id781627066899997" class="paragraph" dir="auto">
    <span class="input" data-tooltip="Click on text to copy to clipboard">svc.Unique(array_1d: any[0..*], casesensitive: bool = False): any[0..*]</span>
  </p>
  <div class="embedded">
<a name="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parameters:</h3>
</div>
  <p id="par_id521582653464553" class="paragraph" dir="auto"><span class="emph">array_1d</span>: The input array.</p>
  <p id="par_id41158265346441" class="paragraph" dir="auto"><span class="emph">casesensitive</span>: Applicable only if the array is populated with strings (Default = <span class="literal">False</span>).</p>
  <div class="embedded">
<a name="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Example:</h3>
</div>
  <div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Click on text to copy to clipboard"><pre dir="auto"><code class="language-visual-basic line-numbers">
    Dim a As Variant
    a = SF_Array.Unique(Array("A", "C", "A", "b", "B"), CaseSensitive := True)
        '  ("A", "B", "C", "b")
  </code></pre></div>


<div class="embedded">
<a name="SF_InternalUse"></a>
      <div class="warning">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/warning.svg" alt="warning" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id851506659675843" dir="auto">All <span class="literal">ScriptForge</span> Basic routines or identifiers that are prefixed with an underscore character "_" are reserved for internal use. They are not meant be used in Basic macros or Python scripts.</p></div>
</div>
<br>
    </div>

<a name="relatedtopics"></a><div class="relatedtopics">
<p class="related" itemprop="mentions" dir="auto"><a name="related"></a><span class="emph">Related Topics</span>
</p>
<div class="relatedbody" itemprop="mentions">
  <div class="embedded"><p class="embedded" dir="auto"><a target="_top" href="en-US/text/scalc/01/04060107.html">Array Functions</a></p></div>
  <div class="embedded"><p class="embedded" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/calc_functions.html">Using Calc Functions in Macros</a></p></div>
  <div class="embedded"><p class="embedded" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/03/sf_dictionary.html"><span class="literal">ScriptForge</span>.<span class="literal">Dictionary</span> service</a></p></div>
</div>
</div>

</div>
<div id="DonationFrame"></div>
<footer><div id="DEBUG" class="debug">
<h3 class="bug">Help content debug info:</h3>
<p dir="auto">This page is: <a href="https://opengrok.libreoffice.org/xref/help/source/text/sbasic/shared/03/sf_array.xhp" target="_blank">/text/sbasic/shared/03/sf_array.xhp</a></p>
<p dir="auto">Title is: ScriptForge.Array service (SF_Array)</p>
<p id="bm_module" dir="auto"></p>
<p id="bm_system" dir="auto"></p>
<p id="bm_HID" dir="auto"></p>
</div></footer>
</body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit