Golang bytes.ToTitle() function example
package bytes
ToTitle returns a copy of the byte input slice with all Unicode letters mapped to their title case.
Golang bytes.ToTitle() function usage example
package main
import (
"bytes"
"fmt"
)
func main() {
str := []byte("this is a title!")
title := bytes.Title(str) // for comparison purpose
totitle := bytes.ToTitle(str)
fmt.Println("Original : " + string(str))
fmt.Println("Title : " + string(title))
fmt.Println("To Title : " + string(totitle))
}
Output :
Original : this is a title!
Title : This Is A Title!
To Title : THIS IS A TITLE!
Advertisement
Something interesting
Tutorials
+22.7k Golang : Set and Get HTTP request headers example
+13.6k Golang : Qt progress dialog example
+7.1k Golang : Transform lisp or spinal case to Pascal case example
+14k Golang : concatenate(combine) strings
+31.9k Golang : Convert an image file to []byte
+10.6k Golang : Resolve domain name to IP4 and IP6 addresses.
+28.6k Get file path of temporary file in Go
+29.2k Golang : missing Git command
+5.2k Golang : Experimental Jawi programming language
+28.5k Golang : Change a file last modified date and time
+11.6k Golang : Surveillance with web camera and OpenCV
+17k Golang : How to save log messages to file?