jaraco / jaraco/inflect

How to force stop some groups in the string

Open
#198 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.1k
Forks
127
PR merge metrics
No merged PRs in 30d

Description

Let's say that I have the number **"41721"**, and I want my result in groups of two, BUT I want to group the first and last two digits of the number. In that case, my desired result is: **"forty-one, seven, twenty-one"**.

Is there any way to force that? I saw an example in documentation using underscore, but couldn't find more explanation to that. So maybe:

```
import inflect
p = inflect.engine()
p.number_to_words("41_7_21", group=2)
p.number_to_words("41-7-21", group=2)
p.number_to_words("41 7 21", group=2)
...
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the inflect.engine().number_to_words entry point and the documented group=2 behavior mentioned in the issue. Determine whether separators such as underscores, hyphens, or spaces can express the requested grouping, and consider the work complete when 41721 produces "forty-one, seven, twenty-one" through a supported input or option.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.