
-- explode(string, seperator, skipEmpty)
function string.explode(p, d, skip)
  local t, ll, l, nw
  
  ll = 0
  t = {}
  if(#p == 1) then return {p} end
    while true do
      l=string.find(p,d,ll,true) -- find the next d in the string
      if l~=nil then -- if "not not" found then..
        nw = string.sub(p,ll,l-1)
        if not skip or #nw > 0 then
            table.insert(t, nw) -- Save it in our array.
        end
        ll=l+1 -- save just after where we found it for searching next time.
      else
        nw = string.sub(p,ll)
        if not skip or #nw > 0 then
            table.insert(t, nw) -- Save what's left in our array.
        end
        break -- Break at end, as it should be, according to the lua manual.
      end
    end
  return t
end

function string.startsWith(String,Start)
   return string.sub(String,1,string.len(Start))==Start
end

function string.endsWith(String,End)
   return End=='' or string.sub(String,-string.len(End))==End
end
