StringRepeat

StringRepeat["str",n]

creates a string consisting of "str" repeated n times.

StringRepeat["str",n,max]

creates a string consisting of up to n copies of "str", truncated to be of maximum total length at most max.

Examples

open allclose all

Basic Examples  (2)

Create a string of 50 a's:

In[1]:=
Click for copyable input
Out[1]=

Repeat a triplet of characters 10 times:

In[2]:=
Click for copyable input
Out[2]=

Truncate after a fixed length:

In[1]:=
Click for copyable input
Out[1]=

Neat Examples  (1)

See Also

StringJoin  Table  ConstantArray  StringPadLeft  StringPadRight  StringPartition  FindRepeat

Introduced in 2015
(10.1)