I'm using this function in InsetExternal

string input = "$$RotateBegin$$ResizeBegin\\input{$$Basename.pstex_t}";
string output = lowercase_subst(input, 
                                "$$rotatebegin",
                                "\\rotatebox{30}{");

output == "\\rotatebox{30}{$$ResizeBegin\\input{$$Basename.pstex_t}"

Shall I put it in lstrings.[Ch]?
Angus



string const lowercase_subst(string const & a,
                             string const & oldstr, string const & newstr)
{
        string lc_str   = support::ascii_lowercase(a);
        string result = a;
        string::size_type off = 0;
        string::size_type roff = 0;
        while (off < lc_str.size() && roff < result.size()) {
                string::size_type const pos = lc_str.find(oldstr, off);
                if (pos == string::npos)
                        break;
                string::size_type const rpos = pos - off + roff;
                result.replace(rpos, oldstr.size(), newstr);
                off  = pos + oldstr.size();
                roff = rpos + newstr.size();
        }

        return result;
}


Reply via email to