Read this in other languages: Tiếng Việt.
What is this?
✂ Vietnamese string processing library.
Installation
Using npm:
$ npm install --save vn-str
Using yarn:
$ yarn add vn-str
Using CDN:
<script src="https://tronghieu60s.github.io/vn-str/dist/index.js"></script>
Usage
1. Number To Text Vietnamese
Example:
var vnStr = require("vn-str");
var str = vnStr.numToText(54);
console.log(str);
2. Remove Vietnamese Tones
Example:
var vnStr = require("vn-str");
var str = vnStr.rmVnTones("trường sa hoàng sa là của việt nam");
console.log(str);
3. Remove Non-Alphanumeric Vietnamese Characters
Example:
var vnStr = require("vn-str");
var str = vnStr.rmNonAlphanumeric(
"Anh ta đã sưu tập nhiều các đồ vật kỳ lạ: trứng chim, tem, nắp chai, dây và cúc áo."
);
console.log(str);
4. Convert String Vietnamese To Unicode Telex / VNI
Example:
var vnStr = require("vn-str");
var str = "Trường Sa, Hoàng Sa là của Việt Nam";
var strTelex = vnStr.strToTelex(str);
console.log(strTelex);
var strVNI = vnStr.strToVNI(str);
console.log(strVNI);
5. Check Vietnamese Phone Number
Example:
var vnStr = require("vn-str");
var isVietnamesePhone = vnStr.isVietnamesePhoneNumber("+84957507468");
console.log(isVietnamesePhone);
Contributing
Pull requests and stars are highly welcome.
For bugs and feature requests, please create an issue.