kotools / types

Explicit types for Kotlin Multiplatform.
https://types.kotools.org
MIT License
90 stars 6 forks source link

✨ `Zero` instance creation from `Any` #658

Closed LVMVRQUXL closed 5 months ago

LVMVRQUXL commented 6 months ago

πŸ“ Description

We want to introduce additional factory functions for creating an instance of Zero from the string representation of Any object.

The regular expression used for validating inputs should be the following: ^[+-]?0+(?:\.0+)?$. Here's the explanation associated to each symbol used in this pattern:

Here's the Application Programming Interface (API) goal:

interface Zero {
    companion object {
        const val PATTERN: String
        fun fromString(number: Any): Zero
        fun fromStringOrNull(number: Any): Zero?
    }
}

βœ… Checklist