Socket
Socket
Sign inDemoInstall

chinese-parseint2

Package Overview
Dependencies
0
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    chinese-parseint2

parse Chinese numeric strings to integer


Version published
Maintainers
1
Created

Readme

Source

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.

Keywords

FAQs

Last updated on 08 Sep 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc