Commit 94d9cc77 authored by Konstantin Shaposhnikov's avatar Konstantin Shaposhnikov Committed by Brad Fitzpatrick

index/suffixarray: add Lookup example

Updates #16360

Change-Id: Idd8523b5a9a496ebd9c6e3b89c30df539842a139
Reviewed-on: https://go-review.googlesource.com/27433Reviewed-by: default avatarC Cirello <uldericofilho@gmail.com>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 7995cb86
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package suffixarray_test
import (
"fmt"
"index/suffixarray"
)
func ExampleIndex_Lookup() {
index := suffixarray.New([]byte("banana"))
offsets := index.Lookup([]byte("ana"), -1)
for _, off := range offsets {
fmt.Println(off)
}
// Unordered output:
// 1
// 3
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment