function SplitStr(inputstr, sep)
  if sep == nil then
    sep = "%s"
  end
  local t = {}
  for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
    table.insert(t, str)
  end
  return t
end

function SplitStrOnNewLines(inputstr)
  local lines = {}
  for s in string.gmatch(inputstr, "[^\r\n]+") do
      table.insert(lines, s)
  end
  return lines
end