XU XUv0.8.8
EN

API

#index/suffixarray

import: #index/suffixarray

counts: 3 函数, 1 方法, 2 类型, 0 常量, 0 方法集

后缀数组 lookup / find_all_index。

struct Index

XuAPI
pub struct Index {
    pub data string
    pub sa []int
}

用途

公开结构体 `Index`。

参数

data string
数据
sa []int
字段([]int)

new

XuAPI
pub fn new(data &string) Index

用途

构造该类型的新值。

参数

data &string
数据(借用,调用方仍持有;类型 &string)

返回

Index — 该类型的值

lookup

XuAPI
pub fn lookup(x &Index, s &string, n int) []int

用途

查找。

参数

x &Index
值(借用,调用方仍持有;类型 &Index)
s &string
源字符串(借用,调用方仍持有;类型 &string)
n int
数量、长度或上限(int)

返回

[]int — 切片结果

struct Match

XuAPI
pub struct Match {
    pub from int
    pub to int
}

用途

公开结构体 `Match`。

参数

from int
字段(int)
to int
字段(int)

find_all_index

XuAPI
pub fn find_all_index(x &Index, s &string, n int) []Match

用途

findall下标。

参数

x &Index
值(借用,调用方仍持有;类型 &Index)
s &string
源字符串(借用,调用方仍持有;类型 &string)
n int
数量、长度或上限(int)

返回

[]Match — 切片结果

(Index) len

XuAPI
pub fn (x Index) len() int

用途

`Index` 上的方法:返回长度。

参数

x Index
接收者 Index(值接收者)

返回

int — 该类型的值