...
Run Format

Source file src/index/suffixarray/example_test.go

Documentation: index/suffixarray

     1  // Copyright 2016 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package suffixarray_test
     6  
     7  import (
     8  	"fmt"
     9  	"index/suffixarray"
    10  )
    11  
    12  func ExampleIndex_Lookup() {
    13  	index := suffixarray.New([]byte("banana"))
    14  	offsets := index.Lookup([]byte("ana"), -1)
    15  	for _, off := range offsets {
    16  		fmt.Println(off)
    17  	}
    18  
    19  	// Unordered output:
    20  	// 1
    21  	// 3
    22  }
    23  

View as plain text