jaraco / jaraco/inflect

number_to_words, group==2 and 3 digit numbers

Open
#217 3 comments 0 reactions 1 assignee Claimed by @NFeruch View on GitHub
help wanted
Dominant language
Python
Stars
1.1k
Forks
127
PR merge metrics
No merged PRs in 30d

Description

The current behavior for three digit numbers with group==2 is to split between the first two and last number. For example:
```
>>> p.number_to_words('123', group=2)
'twelve, three'
>>>
```
It is more common - at least in American English - to split after the first digit which would return `'one twenty-three'`.

I realize a group is an arbitrary split, but I'm not sure the current behavior - at least for 3 digit numbers - reflects any common usage.

I realize there are a few other slightly inconvenient was to accomplish the same thing:

```
>>> ' '.join([p.number_to_words('1'), p.number_to_words('23')])
'one twenty-three'
>>> p.number_to_words('123').replace('hundred and ', '')
'one twenty-three'
>>>
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.