User Tools

Site Tools


function_extract

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

function_extract [2018/08/10 15:08]
Niek created
function_extract [2018/08/11 15:56]
Niek Properly handle empty string
Line 21: Line 21:
  return nil  return nil
  end  end
- -- if present, remove leading "?"​ character from query string 
- a = string.match(a,​ '​[^%?​].+'​) 
  
  if c ~= nil then  if c ~= nil then
Line 33: Line 31:
  c = "*not found*"​   c = "*not found*"​
  end  end
- + 
 + if string.len(a) == 0 then  
 + return c 
 + end 
 + 
 +-- if present, remove leading "?"​ character from query string 
 + a = string.match(a,​ '​[^%?​].+'​) 
  haystack = split(a, '&'​)  haystack = split(a, '&'​)
  for i,n in pairs(haystack)  for i,n in pairs(haystack)
Line 55: Line 60:
  
 return M return M
- 
 </​file>​ </​file>​
function_extract.txt · Last modified: 2018/08/11 15:56 by Niek