Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
x/text/unicode/norm: LastBoundary is inconsistent #9055
The LastBoundary methods seems inconsistent as to where it reports a boundary. When called with a string containing a single (non-combining) character, the boundary is sometimes reported at the start of the string and sometimes at the end: This code: fmt.Printf("%d\n", norm.NFD.LastBoundary(byte("a"))) fmt.Printf("%d\n", norm.NFD.LastBoundary(byte("♔"))) print 0 and 3. I would expect it to print 0 and 0 or 1 and 3. Perhaps it would be better if neither FirstBoundary (LastBoundary) never reported a boundary at the start (end) of a string. That way it becomes easier to use FirstBoundary and LastBoundary to iterate through strings when use of Iter is not convenient.