Capitalize
Overview
Capitalize uppercases the first rune.
If you are coming from Node.js, the closest pattern is _.capitalize(s).
Signature
go
func Capitalize(s string) stringCompare: Node.js · Standard Go · gox
js
_.capitalize('hello');go
// Manual string transformation with strings/unicodego
import "github.com/sahilkhaire/gox/str"
s := str.Capitalize("hello")Example
go
import "github.com/sahilkhaire/gox/str"
s := str.Capitalize("hello")Tips
Import github.com/sahilkhaire/gox/str and call Capitalize directly. See the comparison below for the standard library equivalent.
Standard library alternative
gox wraps the Go standard library or a trusted dependency with Node-familiar naming. You can use the underlying library directly — see the package overview for escape hatches.