Skip to content
Node: _.capitalize(s)github.com/sahilkhaire/gox/str

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) string

Compare: Node.js · Standard Go · gox

js
_.capitalize('hello');
go
// Manual string transformation with strings/unicode
go
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.

Back to str package overview

MIT Licensed · Built for Node.js developers moving to Go