Skip to content
Reference > Methods

strRepeat(text,count)

Definition

String strRepeat(String text, Integer count)

Description

Returns a string that repeats the supplied text a specified number of times.

Parameter Definition

Name Type Description
text String The string to repeat
count Integer number of times to repeat

Examples

1
2
3
4
5
String r1 = strRepeat("abc",3); // r1 == abcabcabc
String r2 = strRepeat("0",4); // r2 == 0000
String r3 = strRepeat("",10); // r3 == 
Object r4 = strRepeat(null,2); // r4 == null
Object r5 = strRepeat("2",null); // r5 == null