package
Version:
v0.0.9
Opens a new window with list of versions in this module.
Published: May 15, 2026
License: Apache-2.0
Opens a new window with license information.
Imports: 2
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
slice
切片反转、包含判断等基础操作,包含泛型辅助。
基础用法
ok := slicepkg.Contains([]string{"a", "b"}, "a")
注意事项
大切片高频查找可改用 map,避免线性扫描造成性能问题。
验证
go test ./slice
Documentation
¶
Deprecated: 使用 Contains 替代
func Reverse(slice interface{})
Deprecated: 使用 ReverseSlice 替代。
注意:Reverse 使用 reflect,性能较差且缺乏编译期类型检查。
func ReverseSlice[T any](s []T)
ReverseSlice 原地反转切片
Source Files
¶
Click to show internal directories.
Click to hide internal directories.