mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
compiler: add [..2]
& [2..]
support for slices
This commit is contained in:

committed by
Alexander Medvednikov

parent
e80cf185b9
commit
a075ce160e
@ -146,6 +146,12 @@ pub fn (s array) right(n int) array {
|
||||
return s.slice(n, s.len)
|
||||
}
|
||||
|
||||
// used internally for [2..4]
|
||||
fn (s array) slice2(start, _end int, end_max bool) array {
|
||||
end := if end_max { s.len } else { _end }
|
||||
return s.slice(start, end)
|
||||
}
|
||||
|
||||
pub fn (s array) slice(start, _end int) array {
|
||||
mut end := _end
|
||||
if start > end {
|
||||
|
Reference in New Issue
Block a user