Skip to content

Modern String Repeat

Paul Squires edited this page Oct 19, 2026 · 5 revisions

Home › String Library › String Library › Repeat

Repeat

Returns a string repeated n times.

Syntax

Repeat( count, s )

Notes

  • O(n*count)

Examples

#import "std/strings"
using strings

print Repeat( 3, "ab" )       '' ababab
print Repeat( 0, "ab" )       '' (empty) -- 0 or less gives ""

'' STRING( n, ch ) repeats one character; this repeats a whole string,
'' in one allocation rather than n concatenations
print Repeat( 20, "-" )       '' --------------------

Library: String Library
Category: String Library
Documented under: The Functions

Clone this wiki locally