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

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

✨ Zero instance creation from Any #658

LVMVRQUXL opened this issue May 10, 2024 · 0 comments
Assignees
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.
  • [] Character set. Matches any character in the set.
  • + Character. Matches a "+" character (char code 43).
  • - Character. Matches a "-" character (char code 45).
  • ? 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.
  • (?:) Non-capturing group. Groups multiple tokens together without creating a capture group.
  • \. 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 PATTERN: String
        fun fromString(number: Any): Zero
        fun fromStringOrNull(number: Any): Zero?
    }
}

βœ… Checklist

  • ✨ Add the 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 an entry for this issue in the 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
@LVMVRQUXL LVMVRQUXL self-assigned this Jun 4, 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