Standard library / bytes

bytes.TrimLeftFunc()

Removes leading runes satisfying f. The returned slice may alias the input. Expected stdout: 'go34\n'.

Formal Syntax & Structure

go syntaxgo
func TrimLeftFunc(s []byte, f func(r rune) bool) []byte

Parameters & Attributes

NameTypeDescription
s[]byteInput text or sequence.
ffunc(r rune) boolPredicate over decoded runes.

Return Value

[]byte

Removes leading runes satisfying f. The returned slice may alias the input.

Working Example

Example Snippetgo
package main
import (  "bytes"  "fmt"  "unicode")
func main() {  fmt.Println(string(bytes.TrimLeftFunc([]byte("12go34"), unicode.IsDigit)))}
Go Reference