struct Index
XuAPI
pub struct Index {
pub data string
pub sa []int
}用途
公开结构体 `Index`。
参数
datastring- 数据
sa[]int- 字段([]int)
API
#index/suffixarray后缀数组 lookup / find_all_index。
struct Indexpub struct Index {
pub data string
pub sa []int
}公开结构体 `Index`。
data stringsa []intnewpub fn new(data &string) Index构造该类型的新值。
data &stringIndex — 该类型的值
lookuppub fn lookup(x &Index, s &string, n int) []int查找。
x &Indexs &stringn int[]int — 切片结果
struct Matchpub struct Match {
pub from int
pub to int
}公开结构体 `Match`。
from intto intfind_all_indexpub fn find_all_index(x &Index, s &string, n int) []Matchfindall下标。
x &Indexs &stringn int[]Match — 切片结果
(Index) lenpub fn (x Index) len() int`Index` 上的方法:返回长度。
x Indexint — 该类型的值