PHP » GoLang |
login |
register |
about
|
array_slicearray_slice[code]
func ArraySlice(s []interface{}, offset, length uint) []interface{} {
if offset > uint(len(s)) {
panic("offset: the offset is less than the length of s")
}
end := offset + length
if end < uint(len(s)) {
return s[offset:end]
}
return s[offset:]
}
[/code]
|