Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Lua标点符号字符串模式(%p)中包括哪些字符?_Lua_Punctuation_Lua Patterns - Fatal编程技术网

Lua标点符号字符串模式(%p)中包括哪些字符?

Lua标点符号字符串模式(%p)中包括哪些字符?,lua,punctuation,lua-patterns,Lua,Punctuation,Lua Patterns,我无法找到Lua中标点符号集的复合字符文档。%p。%p由C函数ispunt()匹配,该函数匹配以下内容: 041 ‘‘!’’ 042 ‘‘ ’’ 043 ‘‘#’’ 044 ‘‘$’’ 045 ‘‘%’’ 046 ‘‘&’’ 047 ‘‘’’’ 050 ‘‘(’’ 051 ‘‘)’’ 052 ‘‘*’’ 053 ‘‘+’’ 054 ‘‘,’’ 055 ‘‘-’’ 0

我无法找到Lua中标点符号集的复合字符文档。

%p

%p
由C函数
ispunt
()匹配,该函数匹配以下内容:

041 ‘‘!’’     042 ‘‘ ’’       043 ‘‘#’’       044 ‘‘$’’       045 ‘‘%’’ 
046 ‘‘&’’     047 ‘‘’’’       050 ‘‘(’’       051 ‘‘)’’       052 ‘‘*’’ 
053 ‘‘+’’     054 ‘‘,’’       055 ‘‘-’’       056 ‘‘.’’       057 ‘‘/’’ 
072 ‘‘:’’     073 ‘‘;’’       074 ‘‘<’’       075 ‘‘=’’       076 ‘‘>’’ 
077 ‘‘?’’     100 ‘‘@’’       133 ‘‘[’’       134 ‘‘\’’       135 ‘‘]’’ 
136 ‘‘^’’     137 ‘‘_’’       140 ‘‘‘’’       173 ‘‘{’’       174 ‘‘|’’ 
175 ‘‘}’’     176 ‘‘~’’
041'!”042 ‘‘ ’’       043 ‘‘#’’       044 ‘‘$’’       045 ‘‘%’’ 
046 ‘‘&’’     047 ‘‘’’’       050 ‘‘(’’       051 ‘‘)’’       052 ‘‘*’’ 
053 ‘‘+’’     054 ‘‘,’’       055 ‘‘-’’       056 ‘‘.’’       057 ‘‘/’’ 
072 ‘‘:’’     073 ‘‘;’’       074 ‘‘’’ 
077 ‘‘?’’     100 ‘‘@’’       133 ‘‘[’’       134 ‘‘\’’       135 ‘‘]’’ 
136 ‘‘^’’     137 ‘‘_’’       140 ‘‘‘’’       173 ‘‘{’’       174 ‘‘|’’ 
175 ‘‘}’’     176 ‘‘~’’

(来自
man ispunt

查找它们的小脚本:

for i=0,255 do
    if string.match(string.char(i), "%p") then
        io.write(string.char(i))
    end
end
io.write("\n")

-- $ luajit test.lua
-- !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
i=0255 do的

如果string.match(string.char(i),“%p”),那么
io.write(string.char(i))
结束
结束
io.write(“\n”)
--$luajit test.lua
-- !"#$%&'()*+,-./:;?@[\]^_`{|}~

答案取决于语言环境,它是C函数的直接接口。
事实上,如果有一个C标准函数执行类似于Lua函数的操作,那么几乎可以肯定的是,即使不看具体情况,Lua函数也只是包装了C函数、缺点和所有东西。
(这是文件:read()在5.2中仍然存在,甚至可能在5.3中也会存在的部分原因)

虽然给出了,并且给出了,但C标准只说:

ispunct()
:函数测试任何打印字符,这些字符是特定于语言环境的标点字符集之一,而
isspace
isalnum
都不是真的“locale,
ispunct
对于
isspace
isalnum
都不为true的每个打印字符,返回true