Standard library / bytes

bytes.TrimLeft()

Removes leading runes in cutset; stops at the first nonmember. The returned slice may alias the input. Expected stdout: 'go.\n'.

Formal Syntax & Structure

go syntaxgo
func TrimLeft(s []byte, cutset string) []byte

Parameters & Attributes

NameTypeDescription
s[]byteInput text or sequence.
cutsetstringSet of code points to remove from the indicated ends.

Return Value

[]byte

Removes leading runes in cutset; stops at the first nonmember. The returned slice may alias the input.

Working Example

Example Snippetgo
package main
import (  "bytes"  "fmt")
func main() {  fmt.Println(string(bytes.TrimLeft([]byte("..go."), ".")))}
Go Reference