Hi im trying to split a string at a fullstop/dot = “.”
Im struggling to this using the below. I think its due to the fullstop being a magic character yet I dont know how to tell the expression to look for it. Help greatly appreciated. Thanks,
[code]
local function split(pString, pPattern)
local Table = {} – NOTE: use {n = 0} in Lua-5.0
local fpat = “(.-)” … pPattern
local last_end = 1
local s, e, cap = pString:find(fpat, 1)
while s do
if s ~= 1 or cap ~= “” then
table.insert(Table,cap)
end
last_end = e+1
s, e, cap = pString:find(fpat, last_end)
end
if last_end <= #pString then
cap = pString:sub(last_end)
table.insert(Table, cap)
end
return Table
end
[/code] [import]uid: 118379 topic_id: 34146 reply_id: 334146[/import]