문제

I am trying to remove '$' signs from a string, but I am guessing it is some special char? I am extremely new to lua (just started coding in it today). From my understanding this should work and does for other chars string.gsub(line,'$','').

도움이 되었습니까?

해결책

yup, that's a special character for pattern matching. you need to escape it with the % symbol.

local s = 'asdf$erer$iiuq'
print(s:gsub('%$', ''))

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