-
-
Notifications
You must be signed in to change notification settings - Fork 45
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
Provide quick (unique) numerify, letterify, bothify and regexify providers #122
Comments
Hi @darioseidl , thanks for opening this issue. I can definitely see the point in having I've also been thinking about how one could create own implementations of
|
Great, thanks! With those functions kotlin-faker would be a nice drop-in replacement for JavaFaker. Adding custom providers is only something I was wondering about, not something that I would really need at the moment. |
@darioseidl , the PR is merged and documentation for new functions can be found here https://serpro69.github.io/kotlin-faker/wiki/extras/#random-strings-from-templates |
Thanks, that was quick! I gave the snapshot a try and it works just as I had hoped. The unqiue value generation is super handy (for those new functions and in general). I had a similar wrapper for generating unique values from JavaFaker, but having it out of the box for all providers is just great. |
With JavaFaker, it's possibly to quickly generate strings or numbers with
numerify
,letterify
,bothify
andregexify
. It's a little hidden, only documented in the javadoc.numerify replaces # with numbers in a string,
letterify replaces ? with uppercase lettrs in a string,
and bothify does both.
regexify generates a string that matches the a given regular expression.
It would be nice if those were availablein kotlin-faker too, especially if they could also be made unique.
I see the
FakerService
does havenumerify
,letterify
andgenerexify
, but it seems those are only used for implementing the various providers, and not meant to be used directly?Basically, it would be great to just write something like,
If I could, I would just add the following locally, but
FakerService
andAbstractFakeDataProvider
are package internal.Is there a way to add a custom provider like that without having to reference internal classes?
The text was updated successfully, but these errors were encountered: