UTF-8
- parseStringNumber(str)
- В
node.js
:
const parser = require("path/to/numstringparser.js");
console.log(parser("сто двадцать три"));
- В
requireJS
:
require(["numstringparser"], function(parser){
alert(parser("сто двадцать три"));
});
- В
HTML
:
<script src="numstringparser.js"></script>
...
<script>
alert(parseStringNumber("сто двадцать три"));
</script>
- str - число в строковой записи (может быть от -999 999 999 999 999 до 999 999 999 999 999)
Число
parseStringNumber("одна тысяча сто одиннадцать") --> 1111
- Bad digits string - неверно записаны какие-либо цифры в строке, переданной в качестве аргумента
- Bad function argument - неверный формат строки, переданной в качестве аргумента
- Need function argument - не передан аргумент функции. str равен NaN или undefined