How to search Unicode whitespace char in Lua
snippet in lua

How to search Unicode whitespace char in Lua

user2755

--table to be filled 
local whitespace = {0x9, 0xA, 0xB, 0xC, 0xD, 0x20, 0x85, 0xA0, 0x1680, 0x2000, 0x2001}

local str = 'hello\u{2000}world\n'
for _, c in utf8.codes(str) do
    for _, v in ipairs(whitespace) do
        if c == v then
            print 'whitespace found'
        end
    end
end