<p>Your algorithm have to handle 0 between first and last digits as well. Insert 零 for those cases.</p>
<p>For example,</p>
<blockquote>
<p>10003 should be 一萬零三.</p>
<p>10301 should be 一萬零三百零一.</p>
<p>30028 should be 三萬零二十八.</p>
<p>41009 should be 四萬一千零九.</p>
</blockquote>

CC BY-SA 4.0
2019-07-31T23:34:04.870Z
2019-07-31T23:34:04.870Z
2020-06-17T09:50:11.587Z
OmniBus
<p>My current task includes writing-out numbers in different languages, also mandarin. I have never grappled with mandarin but I checked several resource and tested my algorithm to the best of my believe. But to really make sure that everything works fine I would highly appreciate a second look of a native speaker. Since I don't know any native speakers I came to this place looking for help.</p>

<p>My algorithm can be accessed here: <a href="https://codepen.io/f16r/pen/xvrwOx" rel="nofollow noreferrer">https://codepen.io/f16r/pen/xvrwOx</a>
It is intended to work from 0 to 19999.</p>

<p>Any help is highly appreciated.
Thank you very much!</p>

CC BY-SA 4.0
2019-07-31T19:14:09.077Z
Good job, the grammar is correct and it works well.
explicitEllipticGroupAction
CC BY-SA 4.0
2019-07-31T23:06:50.833Z
I second that, works fine! The result seems to have line breaks after thousands, then after hundreds. Is that intentional? Maybe that comes from "write.innerHTML = result.replace(/,/g, '<br>');" the <br>?
Pedroski
<mandarin><number>
Writing-out numbers in mandarin till 19999 algorithm
# Writing-out numbers in mandarin till 19999 algorithm

(Asked by: username_0 on 2019-07-31)

My current task includes writing-out numbers in different languages, also mandarin. I have never grappled with mandarin but I checked several resource and tested my algorithm to the best of my believe. But to really make sure that everything works fine I would highly appreciate a second look of a native speaker. Since I don't know any native speakers I came to this place looking for help.

My algorithm can be accessed here: <https://codepen.io/f16r/pen/xvrwOx>
It is intended to work from 0 to 19999.

Any help is highly appreciated.
Thank you very much!

**Tags:** mandarin, number

> **Comments:**
> **username_1**: Good job, the grammar is correct and it works well.  
> **username_2**: I second that, works fine! The result seems to have line breaks after thousands, then after hundreds. Is that intentional? Maybe that comes from "write.innerHTML = result.replace(/,/g, '<br>');" the <br>?  

---

## 1 answers

### Answer by username_3 on 2019-07-31. Score: 2 | Accepted answer

Your algorithm have to handle 0 between first and last digits as well. Insert 零 for those cases.

For example,

> 10003 should be 一萬零三.
>
> 10301 should be 一萬零三百零一.
>
> 30028 should be 三萬零二十八.
>
> 41009 should be 四萬一千零九.


---

