I have something like
str = "What a wonderful string //011// this is"
I have to replace the //011//
with something like convertToRoman(011)
and then get
str = "What a wonderful string XI this is"
However, the conversion into roman numbers is no problem here.
It is also possible that the string str
didn't has a //...//
. In this case it should simply return the same string.
function convertSTR(str)
if not string.find(str,"//") then
return str
else
replace //...// with convertToRoman(...)
end
return str
end
I know that I can use string.find
to get the complete \\...\\
sequence. Is there an easier solution with pattern matching or something similiar?