Giter Site home page Giter Site logo

moonlynx / numstringparser Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 143 KB

Перевод строковой записи числа в цифровую ("одна тысяча сто одиннадцать" --> 1111)

License: MIT License

JavaScript 98.97% CSS 0.94% HTML 0.09%

numstringparser's Introduction

Переводит строковую запись числа в цифровую

Используемая кодировка:

UTF-8

API:

  1. 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>

Описание методов:

parseStringNumber(str)

Аргументы:

  1. str - число в строковой записи (может быть от -999 999 999 999 999 до 999 999 999 999 999)

Вывод:

Число

Пример:

parseStringNumber("одна тысяча сто одиннадцать") --> 1111

Ошибки:

  1. Bad digits string - неверно записаны какие-либо цифры в строке, переданной в качестве аргумента
  2. Bad function argument - неверный формат строки, переданной в качестве аргумента
  3. Need function argument - не передан аргумент функции. str равен NaN или undefined

numstringparser's People

Contributors

moonlynx avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.