Skip to content

strings: document difference of ToTitle, ToUpper, Title #33302

@reiy-leo

Description

@reiy-leo
go version go1.12.7 darwin/amd64

Does this issue reproduce with the latest release?

func desc in golang.org/pkg/
ToTitle returns a copy of the string s with all Unicode letters mapped to their title case.
Title returns a copy of the string s with all Unicode letters that begin words mapped to their title case.
ToUpper returns a copy of the string s with all Unicode letters mapped to their upper case.

So what are the definitions of upper case and title case in golang? the description in godocs is confusing. Could you please specify the differences?

The examples used in golang.org/pkg/ speaks nothing. all of them produces the same results no matter which func is used.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/******/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/******/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.12.7/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.12.7/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/******/Documents/Playground/B/Go-Programming-Cookbook-Second-Edition/chapter1/bytestrings/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/rf/x53btrqj55v077g8_7z4yb280000gp/T/go-build762210892=/tmp/go-build -gno-record-gcc-switches -fno-common"

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.help wanted

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions