10.01.2020, 14:10
(This post was last modified: 10.01.2020, 14:21 by Trond Hoyem.)
(10.01.2020, 14:06)admin Wrote: You can fix encoding of your ESF here: https://openrb.com/convert/Yea, but as I recall, that one does not work with large files.
It is not a big thing, we are normally not using the special characters, but sometimes they are there.. :-)
For anyone that might need the same function, Here is the working code, a little cleaned up:
Code:
finn = 'Text to find'
replace = 'Text to add'
kriterie = 'Filter criteria'
liste = db:getall('SELECT name, id FROM objects WHERE name LIKE "%'.. kriterie .. '%"')
for _, name in ipairs(liste) do
navn = name.name
newName = string.gsub(navn, finn, replace)
log(navn, newName)
db:update('objects', { name = newName }, { id = name.id })
end
log('FINISHED')
script.disable(_SCRIPTNAME)
There are 10 kinds of people in the world; those who can read binary and those who don't