Confusing ToUpper and ToTitle

Issue Is there any difference between the ToUpper and the ToTitle function? Solution See this example on the difference of titlecase/uppercase: package main import ( “fmt” “strings” ) func main() { str := “dz” fmt.Println(strings.ToTitle(str)) fmt.Println(strings.ToUpper(str)) } (Note “dz” here

Continue reading

How to remove non-printable characters

Issue I’m trying to remove non-printable characters from a string in Golang. https://play.golang.org/p/Touihf5-hGH invisibleChars := “Douglas​” fmt.Println(invisibleChars) fmt.Println(len(invisibleChars)) normal := “Douglas” fmt.Println(normal) fmt.Println(len(normal)) Output: Douglas​ 10 Douglas 7 The first string has an invisible char at the end. I’ve tried

Continue reading