Skip to content

go-capitalize is a Go library for capitalizing proper names. 🔠

License

Notifications You must be signed in to change notification settings

fonini/go-capitalize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-capitalize

GoDoc Test Status codecov Go Report Card

go-capitalize is a Go library for capitalizing proper names.

Usage

import "github.com/fonini/go-capitalize/capitalize"

The capitalize package exports a single Capitalize() function. A simple example:

name, _ := capitalize.Capitalize("jonnas fonini")
fmt.Println(name) // will output: "Jonnas Fonini"

name, _ = capitalize.Capitalize("ruA DA praça xv")
fmt.Println(name) // will output: "Rua da Praça XV"

// With additional exceptions
options := capitalize.Options{
    Exceptions: []string{"of"},
    Surnames: []string{"McElroy"},
}

name, _ = capitalize.Capitalize("gørvel fadersdotter of giske", options)
fmt.Println(name) // will output: "Gørvel Fadersdotter of Giske"

name, _ = capitalize.Capitalize("john mcelroy", options)
fmt.Println(name) // will output: "John McElroy"

Thanks

Thanks to Fausto Gonçalves Cintra for the original PHP code.

About

go-capitalize is a Go library for capitalizing proper names. 🔠

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Languages