Standard library / strings

strings.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, chars string) int

Parameters & Attributes

NameTypeDescription
sstringInput 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 (  "fmt"  "strings")
func main() {  fmt.Println(strings.LastIndexAny("aéa", "é"))}
Go Reference