我試圖在Lua中找到字符串中的十六進制非可打印字符00h。我用轉義字符試了一下,結果我得到了相同的位置(這是一個可打印的字符)。我擺弄了角色類,但這不算什麼。我的方法是這樣的:Lua:在字符串中查找十六進制值
location = string.find(variable,"\00",startlocation)
我也嘗試過這種方式,但沒有運氣:
location = string.find(variable, string.char(00),startlocation)
我如何才能找到在Lua這個非打印模式?
你嘗試'位置= string.find(變量, 「\ 0」,startlocation)'用一個零? – dasblinkenlight 2012-01-27 10:56:42
一個,兩個或三個零是相同的東西。 – lhf 2012-01-27 11:01:12
不應該爲模式中的零個字符使用'%z'(至少在5.1中)? – jpjacobs 2012-01-27 11:10:16