Changes

Jump to navigation Jump to search
1,624 bytes added ,  22:08, 9 August 2014
==array:subarray==
 
{| width='100%'
| width='120' | '''Signatures'''
|-
| '''Summary'''
| Gets an array containing all members from a supplied array starting at a supplied position, up to a specified length.<br/>The two-argument version of the function returns the same result as the three-argument version when called with {{Code|$length }} equal to the value of {{Code|array:size($array) - $start + 1}}.
|-
| '''Errors'''
|{{Error|FOAY0001|#Errors}} if : {{Code|$start}} is less than one, or if {{Code|$start + $length}} is greater than {{Code|array:size($array) + 1}}.<br/>{{Error|FOAY0002|#Errors}} if : {{Code|$length}} is less than zero.
|-
| '''Examples'''
|
* <code>array:append(['member1'], 'member2')</code> returns the array {{Code|["member1", "member2"]}}.
|}
 
==array:remove==
 
{| width='100%'
| width='120' | '''Signatures'''
|{{Func|array:remove|$array as array(*), $index as xs:integer|array(*)}}
|-
| '''Summary'''
| Constructs a new array without the member at the specified {{Code|$index}}.
|-
| '''Errors'''
|{{Error|FOAY0001|#Errors}}: {{Code|$index}} is not in the range {{Code|1}} to {{Code|array:size($array)}} inclusive.
|-
| '''Examples'''
|
* <code>array:append(["a"], 1)</code> returns the array {{Code|[]}}.
|}
 
==array:insert-before==
 
{| width='100%'
| width='120' | '''Signatures'''
|{{Func|array:insert-before|$array as array(*), $index as xs:integer, $insert as item()*|array(*)}}
|-
| '''Summary'''
| Constructs a new array by adding one new member at a specified position. Setting {{Code|$index}} to the value {{Code|array:size($array) + 1}} delivers the same result as {{Code|array:append($array, $insert)}}.
|-
| '''Errors'''
|{{Error|FOAY0001|#Errors}}: {{Code|$index}} is not in the range {{Code|1}} to {{Code|array:size($array) + 1}} inclusive.
|-
| '''Examples'''
|
* <code>array:insert-before(["a"], 1, "b")</code> returns the array {{Code|["b", "a"]}}.
|}
 
==array:head==
 
{| width='100%'
| width='120' | '''Signatures'''
|{{Func|array:head|$array as array(*)|item()*}}
|-
| '''Summary'''
| Returns the first member of {{Code|$array}}. This function is equivalent to the expression {{Code|$array(1)}}.
|-
| '''Errors'''
|{{Error|FOAY0001|#Errors}}: The array is empty.
|-
| '''Examples'''
|
* <code>array:head(["a", "b"])</code> returns {{Code|"a"}}.
* <code>array:head([["a", "b"], ["c", "d"]])</code> returns the array {{Code|["a", "b"]}}.
|}
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu