strings.Trim bug?

(Matteo Niccoli) #1

Hello, I’d like to know from you if the returned string from strings.Trim is what we expect:

package main

import (

func main() {
fmt.Print(strings.Trim(“”, “.com”))

It should return “ciao” or I miss something. If you run this code you see that return “ia”

(Matteo Niccoli) #2

Sorry, is not a bug :slight_smile: Moderator you can delete the topic. It’s better to use TrimSuffix in this case. The Trim delete all “c” and “o” and .“com” from the source. That’s why it return ia.