mirror of
https://github.com/vlang/v.git
synced 2025-09-15 23:42:28 +03:00
arrays: add a generic arrays.concat(os.args,'abc','xyz')
function (#11985)
This commit is contained in:
parent
4c01627e00
commit
09dfc3f301
2 changed files with 24 additions and 0 deletions
|
@ -280,3 +280,13 @@ pub fn group_by<K, V>(list []V, grouping_op fn (v V) K) map[K][]V {
|
|||
|
||||
return result
|
||||
}
|
||||
|
||||
// concatenate two arrays
|
||||
pub fn concat<T>(a []T, b ...T) []T {
|
||||
mut m := []T{cap: a.len + b.len}
|
||||
|
||||
m << a
|
||||
m << b
|
||||
|
||||
return m
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue