void CChars::Difference(CArrayInt* paiNewToOldIndices, CArrayInt* paiOldToNewIndices, CChars szOldString) { int i; int j; CChars cTemp; char cNew; char cOld; //This will find the index of each character in this string in the old string. paiOldToNewIndices->SetUsedElements(szOldString.Length()); paiOldToNewIndices->SetArrayValues(-1); paiNewToOldIndices->SetUsedElements(Length()); paiNewToOldIndices->SetArrayValues(-1); cTemp.Init(szOldString); for (j = 0; j < Length(); j++) { cNew = GetChar(j); for (i = 0; i < cTemp.Length(); i++) { cOld = cTemp.GetChar(i); if (cOld == cNew) { cTemp.SetChar(i, 1); paiOldToNewIndices->SetValue(i, j); paiNewToOldIndices->SetValue(j, i); break; } } } cTemp.Kill(); }