Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zero instance creation from Any #658

Open
4 tasks
LVMVRQUXL opened this issue May 10, 2024 · 0 comments
Open
4 tasks

Zero instance creation from Any #658

LVMVRQUXL opened this issue May 10, 2024 · 0 comments
Labels
common Item related to all platforms. feature New feature or request.
Milestone

Comments

@LVMVRQUXL
Copy link
Contributor

LVMVRQUXL commented May 10, 2024

📝 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:

  • ^ Beginning. Matches the beginning of the string, or the beginning of a line if the multiline flag (m) is enabled.
  • (?:) Non-capturing group. Groups multiple tokens together without creating a capture group.
  • - Character. Matches a "-" character (char code 45).
  • | Alternation. Acts like a boolean OR. Matches the expression before or after the |.
  • \+ Escaped character. Matches a "+" character (char code 43).
  • ? Quantifier. Match between 0 and 1 of the preceding token.
  • 0 Character. Matches a "0" character (char code 48).
  • + Quantifier. Match 1 or more of the preceding token.
  • \. Escaped character. Matches a "." character (char code 46).
  • $ End. Matches the end of the string, or the end of a line if the multiline flag (m) is enabled.

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

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

✅ Checklist

  • ✨ Add the STRING_PATTERN property with tests, documentation and samples.
  • ✨ Add the fromStringOrNull function with tests, documentation and samples.
  • ✨ Add the fromString function with tests, documentation and samples.
  • 📝 Add entry for this issue in unreleased changelog.
@LVMVRQUXL LVMVRQUXL added feature New feature or request. common Item related to all platforms. labels May 10, 2024
@LVMVRQUXL LVMVRQUXL modified the milestone: 4.5.2 May 10, 2024
@LVMVRQUXL LVMVRQUXL added this to the 4.6.0 milestone May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
common Item related to all platforms. feature New feature or request.
Projects
None yet
Development

No branches or pull requests

1 participant