mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
builtin: make array.delete()
reallocate, provide .delete_many()
(#10889)
This commit is contained in:
@ -862,6 +862,9 @@ There are further built in methods for arrays:
|
||||
* `a.prepend(arr)` insert elements of array `arr` at beginning
|
||||
* `a.trim(new_len)` truncate the length (if `new_length < a.len`, otherwise do nothing)
|
||||
* `a.clear()` empty the array (without changing `cap`, equivalent to `a.trim(0)`)
|
||||
* `a.delete_many(start, size)` removes `size` consecutive elements beginning with index `start`
|
||||
– triggers reallocation
|
||||
* `a.delete(index)` equivalent to `a.delete_many(index, 1)`
|
||||
* `v := a.first()` equivalent to `v := a[0]`
|
||||
* `v := a.last()` equivalent to `v := a[a.len - 1]`
|
||||
* `v := a.pop()` get last element and remove it from array
|
||||
|
Reference in New Issue
Block a user