Skip to content

strings: Title function incorrectly handles word breaks #6801

@arbrown

Description

@arbrown
This is a known bug, but there is no issue (that I could find) for it.

https://code.google.com/p/go/source/browse/src/pkg/strings/strings.go#485

The Title function should return a new copy of a string with each word capitalized (or,
more accurately, the first rune of each word converted to title case, which can
occasionally differ from Upper Case.)

The following sample program illustrates the incorrect current behavior:
http://play.golang.org/p/u8AJs-95-g
The Title function simply assumes any separator character (like the apostrophe, in this
case) is a word boundary.  The reality is somewhat more complicated.  For reference, see:

http://www.unicode.org/reports/tr29/
http://unicode.org/Public/UNIDATA/auxiliary/WordBreakTest.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions