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) []byteParameters & Attributes
| Name | Type | Description |
|---|---|---|
| s | []byte | Input text or sequence. |
| cutset | string | Set 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."), ".")))}