RepeatString

Create a string that contains a specified number of repetitions of the specified string.

Method Signature

RepeatString(string=[string], count=[integer])

Arguments

Argument
Type
Required
Description
Default

string

string

true

The string to repeat.

count

integer

true

The number of times to repeat the string.

Examples

Script Syntax

Run Example

getVal = repeatString( "Boxlang ", 3 );
writeDump( getVal );

Result: Expected Result: Boxlang Boxlang Boxlang

Additional Examples

writeDump( repeatString( "Hi buddy!, Have a nice day.", 2 ) );
// Member function
str = "I love Boxlang ";
writeDump( str.repeatString( 3 ) );

Last updated

Was this helpful?