@Repeat (JavaScript)

Repeats a string.

Defined in

@Functions (JavaScript)

Syntax

@Repeat(value:string, repeat:int) : string

@Repeat(value:string, repeat:int, maxChar:int) : string

Parameter Description
value The string to be repeated.
repeat Number of times to repeat the string.
maxChar Maximum number of characters in the result.
Return value Description
string The value string repeated repeat number of times but not exceeding maxChar.

Examples

(1) This example repeats the hyphen 16 times.
function p(stuff) {
	print("<<<" + stuff + ">>>"); 
 }

var h1 = "+" + @Repeat("-", 16) + "+";
p(h1);
/*
<<<+----------------+>>>
*/

(2) This example repeats asterisk-slash-asterisk to a maximum of 36 characters.

function p(stuff) {
	print("<<<" + stuff + ">>>"); 
 }

var h1 = @Repeat("*/*", 80, 36);
p(h1);
/*
<<<*/**/**/**/**/**/**/**/**/**/**/**/*>>>
*/