Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.