class StringProvider: AbstractFakeDataProvider<StringProvider>

Provides functions for generating values from string expressions.

Fields

Name Description
protected category: Category

Category of this fake data provider class.

protected localUniqueDataProvider: LocalUniqueDataProvider<StringProvider>

A LocalUniqueDataProvider instance that is used with this unique provider.

val unique: StringProvider

An instance of T for generating unique values

Methods

numerify

fun numerify(template: String): (template: String)

Replaces every # char for this template string with a random int from 0 to 9 inclusive, and returns the modified String.

Parameters

Name Description
template: String

ReturnValue

Name Description
(template: String)

letterify

fun letterify(template: String, upper: Boolean?): (template: String, upper: Boolean? = null)

Replaces every ? char for this template string with a random letter from the English alphabet, and returns the modified String.

Parameters

Name Description
template: String
upper: Boolean?

set to true or false to control the case of generated letters.

ReturnValue

Name Description
(template: String, upper: Boolean? = null)

bothify

fun bothify(template: String, upper: Boolean?): (template: String, upper: Boolean? = null)

Combines applies both numerify and letterify functions to the template string, and returns the modified String.

Parameters

Name Description
template: String
upper: Boolean?

set to true or false to control the case of generated letters.

ReturnValue

Name Description
(template: String, upper: Boolean? = null)

regexify

fun regexify(template: String): (template: String)

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.

Refer to RgxGen's Supported Syntaxdocumentation for details on what regex syntax is supported.

Parameters

Name Description
template: String

ReturnValue

Name Description
(template: String)

regexify

fun regexify(regex: Regex): (regex: Regex)

Returns a string of generated values based on the regex, for example regexify(Regex("""\d{3}""")) will return a string consisting of 3 random digits.

Refer to RgxGen's Supported Syntaxdocumentation for details on what regex syntax is supported.

Parameters

Name Description
regex: Regex

ReturnValue

Name Description
(regex: Regex)