문제

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", "")

See also: http://lua-users.org/wiki/StringLibraryTutorial

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top