utf8.gsub
Client-side
Server-side
Shared
This page is incomplete! Help wanted!
Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.
Returns a copy of the original input string with replaced matches from the pattern by the replacement value.
Caution
This function may modify your input string even if no changes were made. Try it with runcode: srun utf8.gsub(utf8.char(66376), "", "") == utf8.char(66376)
Syntax
utf8.gsub ( )Code Examples
server
This example shows how to remove color codes from a string and how to uppercase each single character in a string.
local text= "#ff0000This text is red"local colorless = utf8.gsub( text, "#%x%x%x%x%x%x", "" )print( colorless ) -- This text is red
print( utf8.gsub( "Nice wiki!", ".", utf8.upper ) ) -- NICE WIKI!