Increases the capacity of the array, if necessary, to ensure that at least the number of elements specified by the minimum capacity argument can be stored.

This function does not increase the size of the array, ensures a memory capacity.

1 array.ensureCapacity

<array.ensureCapacity name='name'>
    <minimum_capacity /> !
</array.ensureCapacity>
Example

Increases the minimum capacity of array.

Copy
<xsql-script name='array_ensureCapacity'>
    <body>
        <array name='cities'>
            <string>Barcelona</string>
            <string>Paris</string>
            <string>Roma</string>
        </array>

        <println><array.size name='cities' /></println>

        <array.ensureCapacity name='cities'>
            <number>6</number>
        </array.ensureCapacity>

        <!-- Ensure a capacity does not increases the size. -->
        <println><array.size name='cities' /></println>

    </body>
</xsql-script>

The result is:

Copy
3
3