8000 analysis/report: use the teens rule for every hundred in Ordinal by ozenyunus35 · Pull Request #1841 · dominikh/go-tools · GitHub
[go: up one dir, main page]

Skip to content

analysis/report: use the teens rule for every hundred in Ordinal - #1841

Open
ozenyunus35 wants to merge 1 commit into
dominikh:masterfrom
ozenyunus35:fix-ordinal-teens
Open

ozenyunus35 wants to merge 1 commit into
dominikh:masterfrom
ozenyunus35:fix-ordinal-teens

Conversation

@ozenyunus35

Copy link
Copy Markdown

Closes #1837.

report.Ordinal only applied the "th" exception to 11, 12 and 13 themselves, so 111, 112 and 113 (and 211, 1012, ...) came out as "111st", "112nd" and "113rd". It now checks the last two digits (n%100), so every hundred gets the same teens rule.

TestOrdinal gets cases around 100, 111 to 113, 121 to 123 and 1011 to 1021. The new teen cases fail without the change, and the package tests pass with it.

I used an AI assistant to help draft parts of the code and tests; I reviewed the changes and ran the tests myself.

Ordinal only treated 11 to 13 as "th", so 111, 112 and 113 got "st", "nd" and "rd". Check the last two digits instead.

Closes: dominikhgh-1837
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

report.Ordinal gives wrong suffix for 111th, 112th, 113th (and every hundred after 20)

1 participant

0