@broofa/stringlang

Count string characters by unicode block

Usage no npm install needed!

<script type="module">
  import broofaStringlang from 'https://cdn.skypack.dev/@broofa/stringlang';
</script>

README

StringLang

Count characters by unicode block

Installation

npm i @broofa/stringlang

Example

const StringLang = require('@broofa/stringlang');

const sl = new StringLang('Hello World or Καλημέρα κόσμε or こんにちは 世界');

// Use inspect() to see all block counts
sl.inspect(); // ⇨ { basicLatin: 21, cjkUnifiedIdeographs: 2, greekandCoptic: 13, hiragana: 5 }

// There is also a property for each block containing the character counts
const monkeys = new StringLang('🙈🙉🙊');
monkeys.emoticons; // ⇨ 3


Markdown generated from src/README_js.md by RunMD Logo