Repository navigation
Closed
Labels
DocumentationIssues describing a change to documentation.Issues describing a change to documentation.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.help wanted
Milestone
Description
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"
Reacted by Andrew Todd, Vadim Kulagin and Athul Suresh
Metadata
Metadata
Assignees
Labels
DocumentationIssues describing a change to documentation.Issues describing a change to documentation.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.help wanted
Activity
triztian commentedon Jul 27, 2019
Perhaps adding a reference to the unicode documentation on
ToTitlewould be sufficient?Source: https://unicode.org/faq/casemap_charprop.html
ToUpper,ToLowerandToTitlefollow such specification AFAIK.ianlancetaylor commentedon Jul 27, 2019
I'm not sure we need to change anything here, but I think that at most we should add a link to some Unicode docs. I don't think our docs need to explain title case when it is clearly explained elsewhere.
[-]Difference of ToTitle, ToUpper, Title in mod strings[/-][+]strings: document difference of ToTitle, ToUpper, Title[/+]aqtodd commentedon Jul 27, 2019
Would something along the lines of this make sense?
Additionally, I think it might be helpful to include an example in the strings package showing
TitlevsToTitleused together as they seem easy to confuse.Perhaps something along the lines of:
gopherbot commentedon Jul 27, 2019
Change https://golang.org/cl/187825 mentions this issue:
strings: clarify usage of Title and ToTitle