140 lines
		
	
	
		
			22 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			140 lines
		
	
	
		
			22 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| <!DOCTYPE html>
 | |
| <html lang="en"><!-- use theme color or fallback -->
 | |
| <!--use textcolor from settings, otherwise create a contrasting color to theme color-->
 | |
| <head><meta charset="utf-8"/><link href="./bootstrap/css/bootstrap.min.css" rel="stylesheet"/><link href="./bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet"/><link href="./bootstrap/css/bootstrap-select.min.css" rel="stylesheet"/><link href="http://fonts.googleapis.com/css?family=Open+Sans:400,700,700italic,400italic" rel="stylesheet" type="text/css"/><link href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,600,600italic,400" rel="stylesheet" type="text/css"/><link href="http://netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.css" rel="stylesheet" type="text/css"/><script src="./jquery-1.9.1.min.js"></script><script src="./bootstrap/js/bootstrap.min.js"></script><script src="./bootstrap/js/bootstrap-select.min.js"></script><link href="./styles.css" rel="stylesheet"/><link href="./haxe-nav.css" rel="stylesheet"/><script type="text/javascript">var dox = {rootPath: "./",platforms: ["Neko","Android","Flash","iOS","macOS","Linux","HTML5","Windows"]};</script><script type="text/javascript" src="./nav.js"></script><script type="text/javascript" src="./index.js"></script><link rel="icon" href="./favicon.ico" type="image/x-icon"></link><title>Array - API Reference</title><meta name="description" content="An Array is a storage for values. You can access it using indexes or
 | |
| with its API."/></head><body><style>
 | |
| a, code .type {
 | |
| 	color: #24afc4;
 | |
| }
 | |
| .navbar .brand {
 | |
| 	display: inline-block;
 | |
| 	float: none;
 | |
| 	text-shadow: 0 0 0 transparent;
 | |
| }
 | |
| .nav-list>.active>a.treeLink, .nav-list>.active>a.treeLink:hover, .nav-list>.active>a.treeLink:focus {
 | |
| 	background: #24afc4;
 | |
| 	color: #ffffff;
 | |
| 	text-shadow: 0 0 0 transparent;
 | |
| }
 | |
| .navbar .container {
 | |
| 	width: 940px ;
 | |
| }
 | |
| @media (max-width: 767px) {
 | |
| 	.navbar .container {
 | |
| 		width: auto;
 | |
| 	}
 | |
| }
 | |
| @media (max-width: 979px) and (min-width: 768px) {
 | |
| 	.navbar .container {
 | |
| 		width: 724px;
 | |
| 	}
 | |
| }
 | |
| @media (min-width: 1200px) {
 | |
| 	.navbar .container {
 | |
| 		width: 1170px;
 | |
| 	}
 | |
| }
 | |
| .navbar .container img {
 | |
| 	margin: 5px 0 0 4px;
 | |
| }
 | |
| </style><nav class="nav"><div class="navbar"><div class="navbar-inner" style="background:#FAFAFA; border-bottom:1px solid rgba(0,0,0,.09)"><div class="container"><a class="brand" href="http://www.openfl.org"><img alt="" src="http://www.openfl.org/images/logo.png"/></a><a class="brand" style="color:#777777" href="./">API Reference</a></div></div></div></nav><div class="container main-content"><div class="row-fluid"><div class="span3"><div class="well sidebar-nav"><form class="form-search" id="searchForm"><div class="input-prepend input-block-level"><span class="add-on"><i class="icon-search"></i></span><input id="search" type="text" placeholder="Search" autocomplete="off"/></div></form><div class="dropdown"><select id="select-platform" class="selectpicker" title="Filter by platform" data-width="100%"><option value="all" selected="true">All Platforms</option><option>Neko</option><option>Android</option><option>Flash</option><option>iOS</option><option>macOS</option><option>Linux</option><option>HTML5</option><option>Windows</option></select></div></div><div class="well sidebar-nav"><div id="nav"></div></div></div><div class="span9"><div class="page-header"><h1><small>class</small> Array<<span class="type">T</span>></h1><h4><small><a href="./">no package</a></small></h4>    <h4><small><span class="muted">extended by </span><a class="type" title="" href="./js/RegExpMatch.html">RegExpMatch</a></small></h4><p class="availability"><hr/><em>Available on  all platforms</em></p></div><div class="body"><div class="doc doc-main"><div class="indent"><p>An Array is a storage for values. You can access it using indexes or
 | |
| with its API.</p><p class="javadoc">See:</p><div class="indent inline-content"><p><a href="https://haxe.org/manual/std-Array.html">https://haxe.org/manual/std-Array.html</a></p></div><div class="indent inline-content"><p><a href="https://haxe.org/manual/lf-array-comprehension.html">https://haxe.org/manual/lf-array-comprehension.html</a></p></div></div></div><h3 class="section">Constructor</h3><div class="fields"><div class="field "><a name="new"></a><h3><p><code><a href="#new"><span class="identifier">new</span></a> ()</code></p></h3><div class="doc"><p>Creates a new Array.</p></div></div></div><h3 class="section">Variables</h3><div class="fields"><div class="field "><a name="length"></a><h3><p><code><span class="label">read only</span><a href="./Array.html#length"><span class="identifier">length</span></a>:<a class="type" title="The standard Int type." href="./Int.html">Int</a></code></p></h3><div class="doc"><p>The length of <code>this</code> Array.</p></div></div></div><h3 class="section">Methods</h3><div class="fields"><div class="field "><a name="concat"></a><h3><p><code><a href="#concat"><span class="identifier">concat</span></a> (<span style="white-space:nowrap">a:<a class="type" title="An Array is a storage for values." href="./Array.html">Array</a><<span class="type">T</span>></span>):<a class="type" title="An Array is a storage for values." href="./Array.html">Array</a><<span class="type">T</span>></code></p></h3><div class="doc"><p>Returns a new Array by appending the elements of <code>a</code> to the elements of
 | |
| <code>this</code> Array.</p>
 | |
| <p>This operation does not modify <code>this</code> Array.</p>
 | |
| <p>If <code>a</code> is the empty Array <code>[]</code>, a copy of <code>this</code> Array is returned.</p>
 | |
| <p>The length of the returned Array is equal to the sum of <code>this.<a href="#length">length</a></code>
 | |
| and <code>a.length</code>.</p>
 | |
| <p>If <code>a</code> is <code>null</code>, the result is unspecified.</p></div></div><div class="field "><a name="copy"></a><h3><p><code><a href="#copy"><span class="identifier">copy</span></a> ():<a class="type" title="An Array is a storage for values." href="./Array.html">Array</a><<span class="type">T</span>></code></p></h3><p class="availability"><em>Available on  Neko, Android, Flash, iOS, macOS, Linux, Windows</em></p><div class="doc"><p>Returns a shallow copy of <code>this</code> Array.</p>
 | |
| <p>The elements are not copied and retain their identity, so
 | |
| <code>a[i] == a.copy()[i]</code> is true for any valid <code>i</code>. However,
 | |
| <code>a == a.copy()</code> is always false.</p></div></div><div class="field "><a name="filter"></a><h3><p><code><a href="#filter"><span class="identifier">filter</span></a> (<span style="white-space:nowrap">f:<span class="type">T</span> ‑> <a class="type" title="The standard Boolean type, which can either be true or false." href="./Bool.html">Bool</a></span>):<a class="type" title="An Array is a storage for values." href="./Array.html">Array</a><<span class="type">T</span>></code></p></h3><p class="availability"><em>Available on  Neko, Android, Flash, iOS, macOS, Linux, Windows</em></p><div class="doc"><p>Returns an Array containing those elements of <code>this</code> for which <code>f</code>
 | |
| returned true.</p>
 | |
| <p>The individual elements are not duplicated and retain their identity.</p>
 | |
| <p>If <code>f</code> is null, the result is unspecified.</p></div></div><div class="field "><a name="indexOf"></a><h3><p><code><a href="#indexOf"><span class="identifier">indexOf</span></a> (<span style="white-space:nowrap">x:<span class="type">T</span>,</span> <span style="white-space:nowrap">?fromIndex:<a class="type" title="The standard Int type." href="./Int.html">Int</a></span>):<a class="type" title="The standard Int type." href="./Int.html">Int</a></code></p></h3><div class="doc"><p>Returns position of the first occurrence of <code>x</code> in <code>this</code> Array, searching front to back.</p>
 | |
| <p>If <code>x</code> is found by checking standard equality, the function returns its index.</p>
 | |
| <p>If <code>x</code> is not found, the function returns -1.</p>
 | |
| <p>If <code>fromIndex</code> is specified, it will be used as the starting index to search from,
 | |
| otherwise search starts with zero index. If it is negative, it will be taken as the
 | |
| offset from the end of <code>this</code> Array to compute the starting index. If given or computed
 | |
| starting index is less than 0, the whole array will be searched, if it is greater than
 | |
| or equal to the length of <code>this</code> Array, the function returns -1.</p></div></div><div class="field "><a name="insert"></a><h3><p><code><a href="#insert"><span class="identifier">insert</span></a> (<span style="white-space:nowrap">pos:<a class="type" title="The standard Int type." href="./Int.html">Int</a>,</span> <span style="white-space:nowrap">x:<span class="type">T</span></span>):<a class="type" title="The standard Void type." href="./Void.html">Void</a></code></p></h3><p class="availability"><em>Available on  Neko, Android, Flash, iOS, macOS, Linux, Windows</em></p><div class="doc"><p>Inserts the element <code>x</code> at the position <code>pos</code>.</p>
 | |
| <p>This operation modifies <code>this</code> Array in place.</p>
 | |
| <p>The offset is calculated like so:</p><ul><li>If <code>pos</code> exceeds <code>this.<a href="#length">length</a></code>, the offset is <code>this.<a href="#length">length</a></code>.</li><li>If <code>pos</code> is negative, the offset is calculated from the end of <code>this</code>
 | |
| Array, i.e. <code>this.<a href="#length">length</a> + pos</code>. If this yields a negative value, the
 | |
| offset is 0.</li><li>Otherwise, the offset is <code>pos</code>.</li></ul>
 | |
| <p>If the resulting offset does not exceed <code>this.<a href="#length">length</a></code>, all elements from
 | |
| and including that offset to the end of <code>this</code> Array are moved one index
 | |
| ahead.</p></div></div><div class="field "><a name="iterator"></a><h3><p><code><a href="#iterator"><span class="identifier">iterator</span></a> ():<a class="type" title="An Iterator is a structure that permits iteration over elements of type T." href="./Iterator.html">Iterator</a><<span class="type">T</span>></code></p></h3><div class="doc"><p>Returns an iterator of the Array values.</p></div></div><div class="field "><a name="join"></a><h3><p><code><a href="#join"><span class="identifier">join</span></a> (<span style="white-space:nowrap">sep:<a class="type" title="The basic String class." href="./String.html">String</a></span>):<a class="type" title="The basic String class." href="./String.html">String</a></code></p></h3><div class="doc"><p>Returns a string representation of <code>this</code> Array, with <code>sep</code> separating
 | |
| each element.</p>
 | |
| <p>The result of this operation is equal to <code><a href="./Std.html#string">Std.string</a>(this[0]) + sep +
 | |
| <a href="./Std.html#string">Std.string</a>(this[1]) + sep + ... + sep + <a href="./Std.html#string">Std.string</a>(this[this.<a href="#length">length</a>-1])</code></p>
 | |
| <p>If <code>this</code> is the empty Array <code>[]</code>, the result is the empty String <code>""</code>.
 | |
| If <code>this</code> has exactly one element, the result is equal to a call to
 | |
| <code><a href="./Std.html#string">Std.string</a>(this[0])</code>.</p>
 | |
| <p>If <code>sep</code> is null, the result is unspecified.</p></div></div><div class="field "><a name="lastIndexOf"></a><h3><p><code><a href="#lastIndexOf"><span class="identifier">lastIndexOf</span></a> (<span style="white-space:nowrap">x:<span class="type">T</span>,</span> <span style="white-space:nowrap">?fromIndex:<a class="type" title="The standard Int type." href="./Int.html">Int</a></span>):<a class="type" title="The standard Int type." href="./Int.html">Int</a></code></p></h3><p class="availability"><em>Available on  Neko, Android, Flash, iOS, macOS, Linux, Windows</em></p><div class="doc"><p>Returns position of the last occurrence of <code>x</code> in <code>this</code> Array, searching back to front.</p>
 | |
| <p>If <code>x</code> is found by checking standard equality, the function returns its index.</p>
 | |
| <p>If <code>x</code> is not found, the function returns -1.</p>
 | |
| <p>If <code>fromIndex</code> is specified, it will be used as the starting index to search from,
 | |
| otherwise search starts with the last element index. If it is negative, it will be
 | |
| taken as the offset from the end of <code>this</code> Array to compute the starting index. If
 | |
| given or computed starting index is greater than or equal to the length of <code>this</code> Array,
 | |
| the whole array will be searched, if it is less than 0, the function returns -1.</p></div></div><div class="field "><a name="map"></a><h3><p><code><a href="#map"><span class="identifier">map</span></a><<span class="type">S</span>> (<span style="white-space:nowrap">f:<span class="type">T</span> ‑> <span class="type">S</span></span>):<a class="type" title="An Array is a storage for values." href="./Array.html">Array</a><<span class="type">S</span>></code></p></h3><p class="availability"><em>Available on  Neko, Android, Flash, iOS, macOS, Linux, Windows</em></p><div class="doc"><p>Creates a new Array by applying function <code>f</code> to all elements of <code>this</code>.</p>
 | |
| <p>The order of elements is preserved.</p>
 | |
| <p>If <code>f</code> is null, the result is unspecified.</p></div></div><div class="field "><a name="pop"></a><h3><p><code><a href="#pop"><span class="identifier">pop</span></a> ():<a class="type" title="Null can be useful in two cases." href="./Null.html">Null</a><<span class="type">T</span>></code></p></h3><div class="doc"><p>Removes the last element of <code>this</code> Array and returns it.</p>
 | |
| <p>This operation modifies <code>this</code> Array in place.</p>
 | |
| <p>If <code>this</code> has at least one element, <code>this.<a href="#length">length</a></code> will decrease by 1.</p>
 | |
| <p>If <code>this</code> is the empty Array <code>[]</code>, null is returned and the length
 | |
| remains 0.</p></div></div><div class="field "><a name="push"></a><h3><p><code><a href="#push"><span class="identifier">push</span></a> (<span style="white-space:nowrap">x:<span class="type">T</span></span>):<a class="type" title="The standard Int type." href="./Int.html">Int</a></code></p></h3><div class="doc"><p>Adds the element <code>x</code> at the end of <code>this</code> Array and returns the new
 | |
| length of <code>this</code> Array.</p>
 | |
| <p>This operation modifies <code>this</code> Array in place.</p>
 | |
| <p><code>this.<a href="#length">length</a></code> increases by 1.</p></div></div><div class="field "><a name="remove"></a><h3><p><code><a href="#remove"><span class="identifier">remove</span></a> (<span style="white-space:nowrap">x:<span class="type">T</span></span>):<a class="type" title="The standard Boolean type, which can either be true or false." href="./Bool.html">Bool</a></code></p></h3><p class="availability"><em>Available on  Neko, Android, Flash, iOS, macOS, Linux, Windows</em></p><div class="doc"><p>Removes the first occurrence of <code>x</code> in <code>this</code> Array.</p>
 | |
| <p>This operation modifies <code>this</code> Array in place.</p>
 | |
| <p>If <code>x</code> is found by checking standard equality, it is removed from <code>this</code>
 | |
| Array and all following elements are reindexed accordingly. The function
 | |
| then returns true.</p>
 | |
| <p>If <code>x</code> is not found, <code>this</code> Array is not changed and the function
 | |
| returns false.</p></div></div><div class="field "><a name="reverse"></a><h3><p><code><a href="#reverse"><span class="identifier">reverse</span></a> ():<a class="type" title="The standard Void type." href="./Void.html">Void</a></code></p></h3><div class="doc"><p>Reverse the order of elements of <code>this</code> Array.</p>
 | |
| <p>This operation modifies <code>this</code> Array in place.</p>
 | |
| <p>If <code>this.<a href="#length">length</a> < 2</code>, <code>this</code> remains unchanged.</p></div></div><div class="field "><a name="shift"></a><h3><p><code><a href="#shift"><span class="identifier">shift</span></a> ():<a class="type" title="Null can be useful in two cases." href="./Null.html">Null</a><<span class="type">T</span>></code></p></h3><div class="doc"><p>Removes the first element of <code>this</code> Array and returns it.</p>
 | |
| <p>This operation modifies <code>this</code> Array in place.</p>
 | |
| <p>If <code>this</code> has at least one element, <code>this</code>.length and the index of each
 | |
| remaining element is decreased by 1.</p>
 | |
| <p>If <code>this</code> is the empty Array <code>[]</code>, <code>null</code> is returned and the length
 | |
| remains 0.</p></div></div><div class="field "><a name="slice"></a><h3><p><code><a href="#slice"><span class="identifier">slice</span></a> (<span style="white-space:nowrap">pos:<a class="type" title="The standard Int type." href="./Int.html">Int</a>,</span> <span style="white-space:nowrap">?end:<a class="type" title="The standard Int type." href="./Int.html">Int</a></span>):<a class="type" title="An Array is a storage for values." href="./Array.html">Array</a><<span class="type">T</span>></code></p></h3><div class="doc"><p>Creates a shallow copy of the range of <code>this</code> Array, starting at and
 | |
| including <code>pos</code>, up to but not including <code>end</code>.</p>
 | |
| <p>This operation does not modify <code>this</code> Array.</p>
 | |
| <p>The elements are not copied and retain their identity.</p>
 | |
| <p>If <code>end</code> is omitted or exceeds <code>this.<a href="#length">length</a></code>, it defaults to the end of
 | |
| <code>this</code> Array.</p>
 | |
| <p>If <code>pos</code> or <code>end</code> are negative, their offsets are calculated from the
 | |
| end of <code>this</code> Array by <code>this.<a href="#length">length</a> + pos</code> and <code>this.<a href="#length">length</a> + end</code>
 | |
| respectively. If this yields a negative value, 0 is used instead.</p>
 | |
| <p>If <code>pos</code> exceeds <code>this.<a href="#length">length</a></code> or if <code>end</code> is less than or equals
 | |
| <code>pos</code>, the result is <code>[]</code>.</p></div></div><div class="field "><a name="sort"></a><h3><p><code><a href="#sort"><span class="identifier">sort</span></a> (<span style="white-space:nowrap">f:<span class="type">T</span> ‑> <span class="type">T</span> ‑> <a class="type" title="The standard Int type." href="./Int.html">Int</a></span>):<a class="type" title="The standard Void type." href="./Void.html">Void</a></code></p></h3><div class="doc"><p>Sorts <code>this</code> Array according to the comparison function <code>f</code>, where
 | |
| <code>f(x,y)</code> returns 0 if x == y, a positive Int if x > y and a
 | |
| negative Int if x < y.</p>
 | |
| <p>This operation modifies <code>this</code> Array in place.</p>
 | |
| <p>The sort operation is not guaranteed to be stable, which means that the
 | |
| order of equal elements may not be retained. For a stable Array sorting
 | |
| algorithm, <code>haxe.ds.ArraySort.sort()</code> can be used instead.</p>
 | |
| <p>If <code>f</code> is null, the result is unspecified.</p></div></div><div class="field "><a name="splice"></a><h3><p><code><a href="#splice"><span class="identifier">splice</span></a> (<span style="white-space:nowrap">pos:<a class="type" title="The standard Int type." href="./Int.html">Int</a>,</span> <span style="white-space:nowrap">len:<a class="type" title="The standard Int type." href="./Int.html">Int</a></span>):<a class="type" title="An Array is a storage for values." href="./Array.html">Array</a><<span class="type">T</span>></code></p></h3><div class="doc"><p>Removes <code>len</code> elements from <code>this</code> Array, starting at and including
 | |
| <code>pos</code>, an returns them.</p>
 | |
| <p>This operation modifies <code>this</code> Array in place.</p>
 | |
| <p>If <code>len</code> is < 0 or <code>pos</code> exceeds <code>this</code>.length, an empty Array [] is 
 | |
| returned and <code>this</code> Array is unchanged.</p>
 | |
| <p>If <code>pos</code> is negative, its value is calculated from the end    of <code>this</code>
 | |
| Array by <code>this.<a href="#length">length</a> + pos</code>. If this yields a negative value, 0 is
 | |
| used instead.</p>
 | |
| <p>If the sum of the resulting values for <code>len</code> and <code>pos</code> exceed
 | |
| <code>this.<a href="#length">length</a></code>, this operation will affect the elements from <code>pos</code> to the
 | |
| end of <code>this</code> Array.</p>
 | |
| <p>The length of the returned Array is equal to the new length of <code>this</code>
 | |
| Array subtracted from the original length of <code>this</code> Array. In other
 | |
| words, each element of the original <code>this</code> Array either remains in
 | |
| <code>this</code> Array or becomes an element of the returned Array.</p></div></div><div class="field "><a name="toString"></a><h3><p><code><a href="#toString"><span class="identifier">toString</span></a> ():<a class="type" title="The basic String class." href="./String.html">String</a></code></p></h3><div class="doc"><p>Returns a string representation of <code>this</code> Array.</p>
 | |
| <p>The result will include the individual elements' String representations
 | |
| separated by comma. The enclosing [ ] may be missing on some platforms,
 | |
| use <code><a href="./Std.html#string">Std.string</a>()</code> to get a String representation that is consistent
 | |
| across platforms.</p></div></div><div class="field "><a name="unshift"></a><h3><p><code><a href="#unshift"><span class="identifier">unshift</span></a> (<span style="white-space:nowrap">x:<span class="type">T</span></span>):<a class="type" title="The standard Void type." href="./Void.html">Void</a></code></p></h3><div class="doc"><p>Adds the element <code>x</code> at the start of <code>this</code> Array.</p>
 | |
| <p>This operation modifies <code>this</code> Array in place.</p>
 | |
| <p><code>this.<a href="#length">length</a></code> and the index of each Array element increases by 1.</p></div></div></div></div></div></div></div><footer class="section site-footer" style="background:#FAFAFA"><div class="container"><div class="copyright"><p style="color:#777777">© 2017  <a style="color:#777777" href="http://www.openfl.org">http://www.openfl.org</a></p></div></div></footer><script src=".//highlighter.js"></script><link href="./highlighter.css" rel="stylesheet"/></body></html> |