Repeat

Not available in this language yet.
Repeat( value, [ number ] )
Repeat( value, [ number ] )
Repeat( value, [ number ] )
Not available in this language yet.
Not available in this language yet.
Not available in this language yet.
Repeat( value, [ number ] )

Description

The Repeat function returns a string consisting of the value string repeated number times.

Parameters

Argument Type Definition and Requirements

value

String

The string to repeat.

number

Number

Optional - The number of times the string should be repeated. The default is 2.

Returns

A string with the value repeated the number of times.

Examples

The query below executes an array of independent repeat operations and returns the results in an array. The result array position matches the execution array position. The first operation takes a string Yes and concatenates it with itself. The resultant object YesYes is placed in the top position of the result array. The second operation uses the string Yes containing a trailing space and repeats the string 3 times. The new string Yes Yes Yes is placed in the second position of the result array. The last operation uses the string = and repeats the operation 10 times to produce a string ==========.

System.out.println(
  client.query(
    Arr(
       Repeat("Yes"),
       Repeat("Yes ", 3),
       Repeat("=", 10)
    )
  ).get());
["YesYes", "Yes Yes Yes ", "=========="]

Was this article helpful?

We're sorry to hear that.
Tell us how we can improve! documentation@fauna.com

Thank you for your feedback!