2.0.6 • Published 8 months ago

chinese-parseint2 v2.0.6

Weekly downloads
1,487
License
MIT
Repository
github
Last release
8 months ago

chinese-parseint

Parse Chinese numeric strings to integer; also usable for client-side script.

In browsers (front-end JavaScript)

Download chinese-parseint.js.

Usage

<script src="chinese-parseint.js"></script>
<!-- `chinese_parseInt` would be defined. -->
<script>
    console.log(chinese_parseInt('六八九萬')); ///< display 6890000 in console.
</script>

In Node.js

npm install chinese-parseint

Usage

var chinese_parseInt = require('chinese-parseint');
chinese_parseInt('一千零一十'); ///< returns 1010
chinese_parseInt('二十四万二'); ///< returns 242000

Notes

  • This does NOT check if the string is semantically right in Chinese. For example, chinese_parseInt('千三萬') returns 10030000 instead of NaN even if '千三萬' is not a right term in Chinese.
  • See chinese_parseInt.characters for corresponding numbers of each accepted Chinese character.
  • To convert character encodings (such as from Big5 to UTF-8), consider iconv-lite package.
2.0.6

8 months ago

2.0.5

1 year ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

1.1.10

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

3 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago