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

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

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

Link to this function

asciify(string \\ "****")

View Source

Replaces * signs with random numbers and letters and special characters

Returns String

examples

Examples:

iex> Faker.Core.Helper.asciify("**")

  "s5'G!uC3"
Link to this function

bothify(string \\ "## ??")

View Source

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"

Link to this function

dec_to_hex(number, prefix \\ "0")

View Source

Converts Decimal to Hex

Link to this function

generate_text(max_chars, words_counts)

View Source

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
Link to this function

left_trim(string, separator \\ " ")

View Source
@spec left_trim(string :: String.t(), separator :: String.t()) :: String.t()

Strips whitespace (or other characters) from the end of a string

Returns String

example

Example

  iex> Faker.Core.Text.left_trim("Kamaro.Lambert", ".")
      "Lambert"
Link to this function

lexify(string \\ "????")

View Source

Replaces all question mark ('?') occurrences with a random letter.

Returns String

examples

Examples

iex> Core.Helper.numerify(### #### ??) "soi styz mn"

Link to this function

number_between(min_number \\ 0, max_number \\ 2_147_483_647)

View Source

Generates a random integer between two numbers.

Returns Integer.

examples

Examples

iex> Faker.Core.number_between(7, 392)
75
Link to this function

numerify(string \\ "###")

View Source

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"

Link to this function

paragraph(number_of_sentences \\ 3)

View Source

Generates a single paragraph

Link to this function

paragraphs(number_of_sentece \\ 3, as_text \\ false)

View Source

Generates Paragraphs

Link to this function

parse(string, fill_in_char \\ "?", split_char \\ ".")

View Source

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
Link to this function

random_digit_not(except)

View Source

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
Link to this function

random_element(elements)

View Source

Picks a random element from a list

Return List or Tuple

examples

Examples:

      iex> Faker.Core.Helper.random_elements([32, 4, 7, 8])
          32
Link to this function

random_float(maximum_decimals \\ 6, min_number \\ 0, max_number \\ 9)

View Source

Generates 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"
Link to this function

random_maximum(min \\ 2_147_000_000, max \\ 2_147_483_647)

View Source

Generates largest possible random value

Link to this function

real_text(max_char \\ 200)

View Source
@spec real_text(max_char :: non_neg_integer()) :: String.t()

Get real text based on the length of the charcher

Link to this function

real_text_between(min_char \\ 160, max_char \\ 160)

View Source
@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

Link to this function

right_trim(string, separator \\ " ")

View Source
@spec right_trim(string :: String.t(), separator :: String.t()) :: String.t()

Strips whitespace (or other characters) from the end of a string

Returns String

example

Example

  iex> Faker.Core.Text.right_trim("Kamaro.Lambert", ".")
      "Kamaro"
Link to this function

sentence(number_of_words \\ 6)

View Source

Generates a random sentence

Returns String

examples

Examples:

    iex> Faker.Core.Text.sentence
         "Lorem ipsum dolor sit amet."
Link to this function

sentences(number_of_sentece \\ 3, as_text \\ false)

View Source

Generates random Loresum sentences

Returns List or String

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.

Returns List or String

example

Example:

iex> Faker.Core.shuffle("kamaro")

Splits text

Generates random suffix

Link to this function

swap(element_one, element_two)

View Source

Exchange two number positions

Returns Struct

examples

Examples

iex> Faker.Core.swap(element_1, element_2)
    {element_two, element_one}
Link to this function

swap_numbers(number_1, number_2)

View Source
Link to this function

text(number_of_chars \\ 200)

View Source

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"
Link to this function

words(number_of_words \\ 3, as_text \\ false)

View Source

Generates random Loresum string

Returns List or 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"