Beispiel #1
0
void festring::SearchAndReplace(festring& Where, const festring& What,
                                const festring& With, sizetype Begin)
{
    for(sizetype Pos = Where.Find(What, Begin);
            Pos != NPos; Pos = Where.Find(What, Pos))
    {
        Where.Erase(Pos, What.GetSize());
        Where.Insert(Pos, With);
    }
}
Beispiel #2
0
void festring::SearchAndReplace(festring& Where, cfestring& What,
                                cfestring& With, sizetype Begin)
{
  if(What.IsEmpty())
    ABORT("Infinite loops in SearchAndReplace detected!");

  for(sizetype Pos = Where.Find(What, Begin);
      Pos != NPos; Pos = Where.Find(What, Pos))
  {
    Where.Erase(Pos, What.GetSize());
    Where.Insert(Pos, With);
    Pos += With.GetSize();
  }
}