This topic describes the syntax, description, parameters, and return values of array functions. This topic also provides examples of these functions.
arr_concat
This function concatenates strings in a specified table by using a specified character.
The following table describes the details about this function.
Item | Description |
---|---|
Syntax | arr_concat(tbl, sep) |
Parameter |
|
Example |
|
Return value | Returns a string that is concatenated by using the specified character. In this example,
t1&t2&t3 is returned.
|
arr_insert
This function inserts elements into an array. The following table describes the details
about this function.
Item | Description |
---|---|
Syntax | arr_insert(list, value, [pos]) |
Parameter |
|
Example |
|
Return value | Returns true . In this example, arr_insert:61352 is returned.
|
arr_remove
This function removes elements at the specified position from an array and returns
the removed elements. If you do not set the pos parameter, the element that is at
the end of the array is removed. The following table describes the details about this
function.
Item | Description |
---|---|
Syntax | arr_remove(list, [pos]) |
Parameter |
|
Example |
|
Return value | Returns the element that is removed from the specified array. In this example, arr_remove:3 is returned.
|
arr_sort
This function sorts elements from the beginning to the end of the index in an array
in a specified order.
- If you set the camp parameter, it must be a function that supports two elements in the specified array as its parameters. A value of true is returned if the first element is placed before the second element.
- If you do not set the camp parameter, the elements are sorted based on ANSII codes in ascending order. However, this sorting algorithm may change the original order of two elements that have the same rank in the ANSII table.
Item | Description |
---|---|
Syntax | arr_sort(list, [comp]) |
Parameter |
|
Example |
|
Return value | Returns true . In this example, the following values are returned:
|
arr_len
This function counts the number of elements in an array. The following table describes
the details about this function.
Item | Description |
---|---|
Syntax | arr_len(arr) |
Parameter | arr: the array. |
Example |
|
Return value | Returns the number of elements in the specified array. Data type: numeric. In this
example, 1 is returned.
|