Garry's Mod Wiki

string.Replace

  string string.Replace( string str, string find, string replace )

Description

Replaces all occurrences of the supplied second string.

Arguments

1 string str
The string we are seeking to replace an occurrence(s).
2 string find
What we are seeking to replace.
3 string replace
What to replace find with.

Returns

1 string
The processed string with replacements.

Example

Replaces the word "Garrys" with "Hers".

local text = "Garrys Mod" print(string.Replace(text, "Garrys", "Hers"))
Output: Hers Mod