Skip to content

Kotlin extensions to convert/generate English, Persian, and Arabic digits with ease.

License

Notifications You must be signed in to change notification settings

YektaDev/AnyNum

Repository files navigation

AnyNum

A set of Kotlin extension functions to convert/generate English, Persian, and Arabic digits with ease.

License Powered By Made With

Dependency

Note: AnyNum is now stable and ready; however, I wasn't able to properly configure the gradle file in order to make the library accessible via JitPack. Any contribution would be highly appreciated.

Step 1

Add the JitPack repository in your root build.gradle at the end of repositories (if it doesn't exist):

allprojects {
    repositories {
        // ...
        maven { url 'https://jitpack.io' }
    }
}

Step 2

Add the dependency:

dependencies {
    implementation 'com.github.YektaDev:AnyNum:-SNAPSHOT'
}

Common Usages

AnyNum contains below functions:

Number.toArString(): Generates Arabic digits.

Number.toFaString(): Generates Persian digits.

String.numToEn(): Convertes Arabic & Persian digits to English.

String.numToAr(): Convertes English & Persian digits to Arabic.

String.numToFa(): Convertes English & Arabic digits to Persian.

Note: a Number can be Byte, Short, Int, Long, Float, or Double.

Other Usages

String.numArToEn(): Convertes Arabic digits to English.

String.numFaToEn(): Convertes Persian digits to English.

String.numEnToAr(): Convertes English digits to Arabic.

String.numFaToAr(): Convertes Persian digits to Arabic.

String.numEnToFa(): Convertes English digits to Persian.

String.numArToFa(): Convertes Arabic digits to Persian.