How would i do this?
I got this:
name = "^aH^ai" string.gsub(name, "^a", "")
which should return "Hi", but it grabs the caret character as a pattern character
What would be a work around for this? (must be done in gsub)
How would i do this?
I got this:
name = "^aH^ai" string.gsub(name, "^a", "")
which should return "Hi", but it grabs the caret character as a pattern character
What would be a work around for this? (must be done in gsub)
Try:
name = "^aH^ai"
name = name:gsub("%^a", "")
gsub
written with a :
instead of a .
in this answer? –
Galasyn string
library or as a method on a string
object. The :
is syntax sugar in Lua which effectively implies the object on which the method is called being passed as first parameter. –
Crosshatch © 2022 - 2024 — McMap. All rights reserved.