//--------------------------------------------------------------------------- void tTJSString::Replace(const tTJSString &from, const tTJSString &to, bool forall) { // replaces the string partial "from", to "to". // all "from" are replaced when "forall" is true. if(IsEmpty()) return; if(from.IsEmpty()) return; tjs_int fromlen = from.GetLen(); for(;;) { const tjs_char *st; const tjs_char *p; st = c_str(); p = TJS_strstr(st, from.c_str()); if(p) { tTJSString name(*this, p-st); tTJSString n2(p + fromlen); *this = name + to + n2; if(!forall) break; } else { break; } } }