I want to remove the very last character of a string, but before I do so I want to check if the last character is a \"+\". How can this be done?
Based on the answer of @KarthikGR the following example was added:
https://play.golang.org/p/ekDeT02ZXoq
package main import ( "fmt" "strings" ) func main() { fmt.Println(strings.TrimSuffix("Foo++", "+")) }
returns:
Foo+