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
+5.2k Python : Create Whois client or function example
+24k Golang : Find biggest/largest number in array
+6.2k PHP : Get client IP address
+11.7k Golang : Secure file deletion with wipe example
+10.5k Swift : Convert (cast) String to Integer
+9.3k Golang : How to get username from email address
+13k Golang : Get terminal width and height example
+7.8k Golang : Load DSA public key from file example
+9.1k Golang : Gonum standard normal random numbers example
+16.9k Golang : Get the IPv4 and IPv6 addresses for a specific network interface
+24.5k Golang : GORM read from database example
+17.7k How to enable MariaDB/MySQL logs ?