Garry's Mod Wiki

string.rep

string string.rep( string str, number repetitions, string separator )

Description

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

Arguments

1 string str
The string to convert.
2 number repetitions
Timer to repeat, this values gets rounded internally.
3 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

1 string
Repeated string.

Example

Repeating "abc" 5 times.

print(string.rep("abc", 5))
Output: abcabcabcabcabc

Example

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

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

Page Links


Special Pages


Wikis

?

Render Time: 77ms

DB GetPage 48
Generate Html 5
SaveChanges (1) 9
Render Body 0
Render Sidebar 13