Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

Trim Prefix in Go

Trim prefix is used to trim the characters in the start of the string. Trim prefix is also called as leading trim or left trim.

Example : How to trim leading characters in Go
package main

import (
    "fmt"
    "strings"
)

func main() {
    myString := "Hello worldH"
    trimLeadingString := strings.TrimPrefix(myString, "H")
    fmt.Printf("Leading characters trim : %s\n", trimLeadingString)
}


Output
Leading characters trim : ello worldH