Jump to content
  • 0

Changing text format


FangYX

Question

1 answer to this question

Recommended Posts

I've found it

Quote

Text='<span style="style_1">Text</span><br/><span style="style_1_italic">ItalicText</span>';
while(true) do
    NormalText = string.match(Text, '<span%sstyle="style_.">.-</span>');
    ItalicText = string.match(Text, '<span%sstyle="style_._italic">.-</span>');
    if NormalText ~= nil then
        Text = string.gsub(string.gsub(string.gsub(Text, string.gsub(string.gsub(string.gsub(string.gsub(string.gsub(string.gsub(string.gsub(string.gsub(string.gsub(string.gsub(NormalText, "%(", "%%("), "%)", "%%)"), "%%", "%%%"), "%+", "%%+"), "%-", "%%-"), "%*", "%%*"), "%?", "%%?"), "%[", "%%["), "%^", "%%^"), "%$", "%%$"), string.match(Text, '<span%sstyle="style_.">(.-)</span>')), "<br/>","\n"),"amp;","");
    elseif ItalicText ~= nil then
        Text = string.gsub(string.gsub(string.gsub(Text, string.gsub(string.gsub(string.gsub(string.gsub(string.gsub(string.gsub(string.gsub(string.gsub(string.gsub(string.gsub(ItalicText, "%(", "%%("), "%)", "%%)"), "%%", "%%%"), "%+", "%%+"), "%-", "%%-"), "%*", "%%*"), "%?", "%%?"), "%[", "%%["), "%^", "%%^"), "%$", "%%$"), "<i>"..string.match(Text, '<span%sstyle="style_._italic">(.-)</span>').."</i>"), "<br/>","\n"), "amp;","");
    else
        break;
    end
end
print(Text);

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.