-
Notifications
You must be signed in to change notification settings - Fork 17.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x/text: Title() behaves differently than strings.Title() #51956
Comments
Surprisingly, in the same minutes you, @hangxie and I discovered the same problems: #48367 (comment). |
I'm not sure there is anything to do here. Evidently we were mistaken in thinking that I'm open to suggestions. |
package main
import (
"fmt"
"strings"
"golang.org/x/text/cases"
"golang.org/x/text/language"
)
func main() {
orig := "thisIsCool"
c := cases.Title(language.Und, cases.NoLower).String(orig)
s := strings.Title(orig)
fmt.Printf("orig: %s\ncases: %s\nstrings: %s\n", orig, c, s)
} which outputs
|
Perfect, thank you! |
Add tests for Title function. Signed-off-by: aliwoto <[email protected]>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
https://go.dev/play/p/qGo_iTp7AQ7
What did you expect to see?
cases.Title()
behaves the same asstrings.Title()
, I believe this is what #48367 tells (explicitly)What did you see instead?
cases.Title()
changes the first character to uppercase, and change rest of the string lowercasestrings.Title()
changes the first character to uppercase, leave rest of the string untouched.The text was updated successfully, but these errors were encountered: