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) []byteParameters & Attributes
| Name | Type | Description |
|---|---|---|
| s | []byte | Input text or sequence. |
| f | func(r rune) bool | Predicate 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)))}