Wie zu Trimmen "[" char aus einem string in Golang

Wahrscheinlich eine dumme Sache, aber hängengeblieben ist es für ein bisschen...

Nicht trimmen "[" char aus einem string, Dinge, die ich versucht mit der Ausgänge:

package main

import (
    "fmt"
    "strings"
)

func main() {
    s := "this[things]I would like to remove"
    t := strings.Trim(s, "[")

    fmt.Printf("%s\n", t)   
}

//output: this[things]I would like to remove

gehen Spielplatz

Habe auch versucht haben, ohne Erfolg:

s := "this [ things]I would like to remove"
t := strings.Trim(s, " [ ")
//output: this [ things]I would like to remove


s := "this [ things]I would like to remove"
t := strings.Trim(s, "[")
//output: this [ things]I would like to remove

Keiner war. Was vermisse ich hier?

InformationsquelleAutor Blue Bot | 2016-11-23
Schreibe einen Kommentar