string.rep

From Garry's Mod
Jump to: navigation, search
 string.rep( )

Contents

Description

Repeats a string by the provided number, with an optional separator.

Arguments

string str

The string to convert.

Arguments

number repetitions

Timer to repeat, this values gets rounded internally.

Arguments

string separator=""

String that will separate the repeated piece. Notice that it doesn't add this string to the start or the end of the result, only between the repeated parts.

Returns

string

Repeated string.

Examples

Example

Repeating "abc" 5 times.

print(string.rep("abc", 5))

Output:

abcabcabcabcabc

Examples

Example

Repeating "hello world" 3 times, with the separator " " (space).

print(string.rep("hello world", 3, " "))

Output:

hello world hello world hello world
Personal tools
Navigation