第114天 写一个把数字转成中文的方法,例如:101转成一百零一
Activity
ghost commentedon Aug 8, 2019
函数名很弱智,不要在意(
haizhilin2013 commentedon Aug 8, 2019
@t532 这函数名中英文结合呢,不错不错!
ghost commentedon Aug 8, 2019
@NicholasBaiYa
你好,
你的实现似乎有一些问题?
下面是我尝试的结果:
NicholasBaiYa commentedon Aug 8, 2019
唔~我在改改··位数只写到亿,下钟后在改改,感谢大佬指教
liuxiaole commentedon Aug 8, 2019
toChineseNumeral('1000001'); // expected: 一百万零一
// actual: 一百零万零一
ghost commentedon Aug 8, 2019
@liuxiaole
试着修了一下,现在可以了。
DarthVaderrr commentedon Aug 8, 2019
liuxiaole commentedon Aug 9, 2019
forever-z-133 commentedon Aug 12, 2019
liuxiaole commentedon Aug 12, 2019
returnChineseNumber(201001);
// 预期: 二十万一千零一
// 实际: 二十零万一千零零一
returnChineseNumber(1000000);
// 预期: 一百万
//实际:一百零零万零零零零
liuxiaole commentedon Aug 12, 2019
toChineseNumeral('1110');
// expected 一千一百一十
// actual 一千一百十
‘一十’ 只有在小于20才可以读作“十”或“十几”,所以干脆直接留下“一十”这种情况,或者判断“一十”是否为开头
forever-z-133 commentedon Aug 13, 2019
感谢,代码已更新。
jiamianmao commentedon Aug 13, 2019
不好意思,搞定了,泡妞去了。
jiamianmao commentedon Aug 14, 2019
5 remaining items