summaryrefslogtreecommitdiffstats
path: root/lib/format.lua
diff options
context:
space:
mode:
authorMike Mason <ms13sp@gmail.com>2007-12-04 21:55:36 +0000
committerMike Mason <ms13sp@gmail.com>2007-12-04 21:55:36 +0000
commit9e9c8f167b068fe506e633c71f2395f59bd8ce0b (patch)
tree0623a1e0107ac4cd45f3e9eb242fd47179a808c5 /lib/format.lua
parente1629e16cade9decf1f0045cb51d26198597848e (diff)
downloadacf-core-9e9c8f167b068fe506e633c71f2395f59bd8ce0b.tar.bz2
acf-core-9e9c8f167b068fe506e633c71f2395f59bd8ce0b.tar.xz
Added timezone information to date.lua. Added fs.file_write to be able to add newlines at the end of the file(most strings don't have them) and also added a function to format.lua
git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@408 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'lib/format.lua')
-rw-r--r--lib/format.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/format.lua b/lib/format.lua
index 903a593..dff5019 100644
--- a/lib/format.lua
+++ b/lib/format.lua
@@ -39,6 +39,15 @@ function cap_begin_word ( a )
return data
end
+function search_replace (path , find, replace)
+ local f = fs.read_file_as_array(path)
+ local lines = {}
+ for a,b in ipairs(f) do
+ local c = string.gsub(b, find, replace)
+ lines[#lines + 1] = c end
+ return lines
+end
+
-- This code comes from http://lua-users.org/wiki/SplitJoin
-- -- example: format.table_to_string(", ", {"Anna", "Bob", "Charlie", "Dolores"})