View Source Faker.Core.Internet (faker v0.2.0)
Link to this section Summary
Functions
Replaces * signs with random numbers and letters and special characters
Replaces hash signs ('#') and question marks ('?') with random numbers and letters An asterisk ('*') is replaced with either a random number or a random letter
Converts Decimal to Hex
Generates random text
Convert Hex back to decimal
Validate if a string is a vowel or not
Validate if a string is a vowel or not
Strips whitespace (or other characters) from the end of a string
Replaces all question mark ('?') occurrences with a random letter.
Generates a random integer between two numbers.
Replaces all hash sign ('#') occurrences with a random number Replaces all percentage sign ('%') occurrences with a non-zero number.
Generates a single paragraph
Generates Paragraphs
Replaces tokens ('{{ tokenName }}') with the result from the token method call
Returns a random ascii code
Generates a random digit between 0 and 9.
Generates a random digit between 0 and 9 except passed parameter.
Generates a random digit between 0 and 9 except passed parameter.
Picks a random element from a list
Generates a random float number between two numbers.
Returns a random letter from a to z
Generates largest possible random value
Get real text based on the length of the charcher
Generate a text string by the Markov chain algorithm.
Strips whitespace (or other characters) from the end of a string
Generates a random sentence
Generates random Loresum sentences
Returns a shuffled version of the argument. This function accepts either an List, or a string.
Splits text
Generates random suffix
Exchange two number positions
Generate a text string.
Converts string to lowercase
Converts string to lowercase
Generates a single Word
Generates random Loresum string
Link to this section Functions
Replaces * signs with random numbers and letters and special characters
Returns String
examples
Examples:
iex> Faker.Core.Helper.asciify("**")
"s5'G!uC3"
Replaces hash signs ('#') and question marks ('?') with random numbers and letters An asterisk ('*') is replaced with either a random number or a random letter
Returns String
examples
Examples
iex> Core.Helper.numerify(### #### ##) "soi styz mn"
Converts Decimal to Hex
Generates random text
Convert Hex back to decimal
Validate if a string is a vowel or not
Returns boolean
examples
Examples
iex> Faker.Core.is_not_vowerl("k")
false
Validate if a string is a vowel or not
Returns boolean
examples
Examples
iex> Faker.Core.is_vowerl("a")
true
Strips whitespace (or other characters) from the end of a string
Returns String
example
Example
iex> Faker.Core.Text.left_trim("Kamaro.Lambert", ".")
"Lambert"
Replaces all question mark ('?') occurrences with a random letter.
Returns String
examples
Examples
iex> Core.Helper.numerify(### #### ??) "soi styz mn"
Generates a random integer between two numbers.
Returns Integer
.
examples
Examples
iex> Faker.Core.number_between(7, 392)
75
Replaces all hash sign ('#') occurrences with a random number Replaces all percentage sign ('%') occurrences with a non-zero number.
Returns String
examples
Examples
iex> Core.Helper.numerify(### #### ##) "757 7239 65"
Generates a single paragraph
Generates Paragraphs
Replaces tokens ('{{ tokenName }}') with the result from the token method call
Returns String
examples
Examples
iex> Faker.Core.parse("{{first_name}}.{{last_name}}")
???????.??????
Returns a random ascii code
Returns String
examples
Examples
iex> Faker.Core.random_ascii
"!"
Generates a random digit between 0 and 9.
Returns Integer
.
examples
Examples
iex> Faker.Core.random_digit()
3
Generates a random digit between 0 and 9 except passed parameter.
Returns Integer
.
examples
Examples
iex> Faker.Core.random_digit_not(7)
3
Generates a random digit between 0 and 9 except passed parameter.
Returns Integer
.
examples
Examples
iex> Faker.Core.random_digit_not_zero(7)
3
Picks a random element from a list
examples
Examples:
iex> Faker.Core.Helper.random_elements([32, 4, 7, 8])
32
random_float(maximum_decimals \\ 6, min_number \\ 0, max_number \\ 9)
View SourceGenerates a random float number between two numbers.
Returns Float
.
examples
Examples
iex> Faker.Core.random_float()
87.3
Returns a random letter from a to z
Returns String
examples
Examples
iex> Faker.Core.random_letter
"a"
Generates largest possible random value
@spec real_text(max_char :: non_neg_integer()) :: String.t()
Get real text based on the length of the charcher
@spec real_text_between(min_char :: non_neg_integer(), max_char :: non_neg_integer()) :: String.t()
Generate a text string by the Markov chain algorithm.
Depending on the min_chars, returns a random valid looking text. The algorithm generates a weighted table with the specified number of words as the index and the possible following words as the value.
min_char
Minimum number of characters the text should contain (minimum: 160)
max_char
Maximum number of characters the text should contain (maxmum: 160)
## Example
iex> Faker.Core.Text.real_text_between()
"Alice, swallowing down her flamingo, and began by taking the little golden key"
## example
Strips whitespace (or other characters) from the end of a string
Returns String
example
Example
iex> Faker.Core.Text.right_trim("Kamaro.Lambert", ".")
"Kamaro"
Generates a random sentence
Returns String
examples
Examples:
iex> Faker.Core.Text.sentence
"Lorem ipsum dolor sit amet."
Generates random Loresum sentences
examples
Examples
iex> Faker.Core.Text.sentences
["Numquam minus rerum mollitia omnis pariatur.",
"Tenetur earum aut totam repudiandae quis."]
iex> Faker.Core.Text.sentences(3, true)
"Numquam eum soluta eius ut rerum. Labore sint qui eos aliquid asperiores."
Returns a shuffled version of the argument. This function accepts either an List, or a string.
example
Example:
iex> Faker.Core.shuffle("kamaro")
Splits text
Generates random suffix
Exchange two number positions
Returns Struct
examples
Examples
iex> Faker.Core.swap(element_1, element_2)
{element_two, element_one}
Generate a text string.
Returns String
example
Example
iex> Faker.Core.Text.text
"Sapiente sunt omnis. Ut pariatur ad autem ducimus et. Voluptas rem voluptas sint modi dolorem amet."
Converts string to lowercase
Returns String
examples
Examples:
iex> Faker.Core.Helper.to_lower("KAMARO")
"kamaro"
Converts string to lowercase
Returns String
examples
Examples:
iex> Faker.Core.Helper.to_upper("kamaro")
"KAMARO"
Generates a single Word
Returns String
example
Example
iex> Faker.Core.Text.word
"Lorem"
Generates random Loresum string
examples
Examples
iex> Faker.Core.Text.words
["distinctio", "quo", "incidunt"]
iex> Faker.Core.Text.words(3, true)
"rerum accusamus quo occaecati laboriosam optio excepturi est"