Created
October 15, 2016 04:39
-
-
Save twlca/2b8f56f440f8254d5cda85fa7a103813 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var digits = '0123456789'; // 阿拉伯數字 | |
var small_chinese_digits = '〇一二三四五六七八九'; // 中文小寫數字 | |
var capital_chinese_digits = '零壹貮參肆伍陸㭍捌玖拾佰仟萬億兆'; // 中文大寫數字,應用侷限在金融,例如支票、匯款單、存款/提款單等 | |
// 由阿拉伯數字轉換成小寫中文數字 | |
var year = '106'; | |
year.split('').map( function( item ) { | |
return small_chinese_digits.split('')[item]; | |
}).join(''); | |
// 回傳 "一〇五" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment