-
- All Implemented Interfaces:
-
io.github.serpro69.kfaker.provider.FakeDataProvider
public final class StringProvider extends AbstractFakeDataProvider<StringProvider>
Provides functions for generating values from string expressions.
-
-
Field Summary
Fields Modifier and Type Field Description private final StringProviderunique
-
Method Summary
Modifier and Type Method Description StringProvidergetUnique()An instance of T for generating unique values final Stringnumerify(String template)Replaces every #char for this template string with a random int from 0 to 9 inclusive, and returns the modified String.final Stringletterify(String template, Boolean upper)Replaces every ?char for this template string with a random letter from the English alphabet, and returns the modified String.final Stringbothify(String template, Boolean upper)Combines applies both numerify and letterify functions to the template string, and returns the modified String. final Stringregexify(String template)Returns a string of generated values based on the regex expressions in the template input, for example regexify("""\d{3}""")will return a string consisting of 3 random digits.-
-
Method Detail
-
getUnique
StringProvider getUnique()
An instance of T for generating unique values
-
letterify
final String letterify(String template, Boolean upper)
Replaces every
?char for this template string with a random letter from the English alphabet, and returns the modified String.- Parameters:
upper- set totrueorfalseto control the case of generated letters.
-
bothify
final String bothify(String template, Boolean upper)
Combines applies both numerify and letterify functions to the template string, and returns the modified String.
- Parameters:
upper- set totrueorfalseto control the case of generated letters.
-
-
-
-