Skip to content
A micro library for converting non-english digits in elixir.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib Fix non_english chars in normalize Dec 11, 2018
.travis.yml Travis Configuration fix Jun 15, 2017
LICENSE Bugfix and publish Jun 1, 2017 Update Apr 1, 2018
mix.exs Bump version Dec 11, 2018
mix.lock Update ex_doc Dec 11, 2018


Build Status

A micro library for converting non-english UTF8 digits. (like ۱=1, ۲=2)

Supported languages

Almost all numbers defined in Unicode is supported in Numero.

For more info on supported characters you can visit here


Numero can be installed by adding numero to your list of dependencies in mix.exs:

def deps do
  [{:numero, "~> 0.3.0"}]

Using Numero

On strings for strings:

result = Numero.normalize("1۲۳۰4a۳tس")
# result = "12304a3tس"

Smart numeric convert:

(Convert numbers to Integer or Float based on input string)

result = Numero.normalize_as_number("1۲۳۰4۳")
# result = {:ok, 123043}

result = Numero.normalize_as_number("1۲۳۰4۳.۴5")
# result = {:ok, 123043.45}

result = Numero.normalize_as_number!("1۲۳۰4۳.۴5")
# result = 123043.45

Strip all non numeric chars from a string:

result = Numero.remove_non_digits("12 345abs")
# result = "12345"

# Or even make exceptions for some chars like 'a' and ' ' (space)
result = Numero.remove_non_digits("12 345bas", ~c[a ])
# result = "12 345a"

Checking if a string is all numbers

result = Numero.digit_only?("1234567890")
# result = true

result = Numero.digit_only?("1234567890.a")
# result = false

You can’t perform that action at this time.