Standard library / bytes

bytes.LastIndexAny()

Returns the byte offset of the last rune in chars, or -1. Expected stdout: '1\n'.

Formal Syntax & Structure

go syntaxgo
func LastIndexAny(s []byte, chars string) int

Parameters & Attributes

NameTypeDescription
s[]byteInput text or sequence.
charsstringSet of Unicode code points to match.

Return Value

int

Returns the byte offset of the last rune in chars, or -1.

Working Example

Example Snippetgo
package main
import (  "bytes"  "fmt")
func main() {  fmt.Println(bytes.LastIndexAny([]byte("aéa"), "é"))}
Go Reference