• Dmitry Vyukov's avatar
    bytes, strings: add LastIndexByte · 0fb5475b
    Dmitry Vyukov authored
    Currently the packages have the following index functions:
    
    func Index(s, sep []byte) int
    func IndexAny(s []byte, chars string) int
    func IndexByte(s []byte, c byte) int
    func IndexFunc(s []byte, f func(r rune) bool) int
    func IndexRune(s []byte, r rune) int
    
    func LastIndex(s, sep []byte) int
    func LastIndexAny(s []byte, chars string) int
    func LastIndexFunc(s []byte, f func(r rune) bool) int
    
    Searching for the last occurrence of a byte is quite common
    for string parsing algorithms (e.g. find the last paren on a line).
    Also addition of LastIndexByte makes the set more orthogonal.
    
    Change-Id: Ida168849acacf8e78dd70c1354bef9eac5effafe
    Reviewed-on: https://go-review.googlesource.com/9500Reviewed-by: 's avatarRob Pike <r@golang.org>
    0fb5475b
Name
Last commit
Last update
..
buffer.go Loading commit data...
buffer_test.go Loading commit data...
bytes.go Loading commit data...
bytes_decl.go Loading commit data...
bytes_test.go Loading commit data...
compare_test.go Loading commit data...
equal_test.go Loading commit data...
example_test.go Loading commit data...
export_test.go Loading commit data...
reader.go Loading commit data...
reader_test.go Loading commit data...