string.find help

Posted by Carol L. on Thu 18 Aug 2011 07:07 PM — 3 posts, 12,560 views.

#0
Want to find a variable in a string. The variable changes.

volume = GetFieldValue("sqltable", "sqlfield")

if string.find(header.InnerText, "vol.(volume) Barcode:", "") ~= nil then
local bcode = string.gsub(header.InnerText, "vol.(volume) Barcode:", "");
SetFieldValue("sqltable", "othersqlfield", bcode);
end

I am not doing something right here. How do I put the variable 'volume' in the pattern?
USA Global Moderator #1
instead of
"vol.(volume) Barcode:"
try
"vol.("..volume..") Barcode:"
#2
Thanks! Just started trying to teach myself Lua for work apps. Much appreciated.