Standard library / strings
strings.IndexByte()
Returns the byte offset of the first matching byte, or -1; not a rune search. Expected stdout: '2\n'.
Formal Syntax & Structure
go syntaxgo
func IndexByte(s string, c byte) intParameters & Attributes
| Name | Type | Description |
|---|---|---|
| s | string | Input text or sequence. |
| c | byte | Byte to match or special case mapping, according to type. |
Return Value
int
Returns the byte offset of the first matching byte, or -1; not a rune search.
Working Example
Example Snippetgo
package main
import ( "fmt" "strings")
func main() { fmt.Println(strings.IndexByte("égo", 'g'))}