From 3aff30bd7b6c820089392d8b8defec9ea400637d Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Thu, 25 Aug 2011 20:18:56 +0000 Subject: Added / removed files --- weblogviewfunctions.lua | 52 ------------------------------------------------- 1 file changed, 52 deletions(-) delete mode 100644 weblogviewfunctions.lua (limited to 'weblogviewfunctions.lua') diff --git a/weblogviewfunctions.lua b/weblogviewfunctions.lua deleted file mode 100644 index b809f23..0000000 --- a/weblogviewfunctions.lua +++ /dev/null @@ -1,52 +0,0 @@ -require("html") -require("session") - --- Split a string to an array by delimiter or pattern -function split(str, pat) - if string.find(str, pat) == nil then - return str - end - local t = {} - local fpat = "(.-)" .. pat - local last_end = 1 - local s, e, cap = str:find(fpat, 1) - while s do - if s ~= 1 or cap ~= "" then - table.insert(t,cap) - end - last_end = e+1 - s, e, cap = str:find(fpat, last_end) - end - if last_end <= #str then - cap = str:sub(last_end) - table.insert(t, cap) - end - return t -end --- Insert a string into another string -function string.insert(value, insert, place) - - if place == nil then - place = string.len(value)+1 - end - - return string.sub(value, 1,place-1) .. tostring(insert) .. string.sub(value, place, string.len(value)) - -end - ---Highlight occurences of a word in a string -function string.highlight(txtvalue, searchval, fcolour, bcolour) - - if txtvalue ~=nil and searchval ~= nil then - sStart = string.find(string.lower(txtvalue),string.lower(searchval)) - if sStart ~= nil then - sEnd = sStart + string.len(searchval) - txtvalue = string.insert(txtvalue,"", sEnd) - txtvalue = string.insert(txtvalue,"", sStart) - end - end - - return txtvalue - -end - -- cgit v1.2.3