crocejf2000
Messages postés260Date d'inscriptionlundi 27 janvier 2003StatutMembreDernière intervention27 août 2008
-
14 avril 2003 à 16:48
NitRic
Messages postés402Date d'inscriptionmardi 1 mai 2001StatutMembreDernière intervention15 août 2011
-
20 avril 2003 à 06:23
Salut a tous,
Dans mon éditeur, j'ai fait un find-replace, il est un peut lent donc si vous avez des algo qui vont plus vite c'est pas de refus :
int NoLigne = 0; // Ligne en cours
int LineCount = m_pBuddy->m_pTextBuffer->GetLineCount(); // Nombre de ligne
CString StrLigne, StrLigneTmp;
int StrLenTxt = m_sText.GetLength(); // Longueur du mot a chercher
int StrLenLigne; // Longueur de la ligne en cours
int x,y;
while (NoLigne < LineCount)
{
StrLigne = m_pBuddy->m_pTextBuffer->GetLineChars(NoLigne); // Recuperation de la ligne
StrLenLigne = m_pBuddy->m_pTextBuffer->GetLineLength(NoLigne); // Nombre de caracteres dans la ligne
for (int i = 0; i < (StrLenLigne - StrLenTxt); i++)
{
lstrcpyn(StrLigneTmp.GetBuffer(StrLenTxt), StrLigne.GetString() + i, StrLenTxt+1);
if (m_sText.CompareNoCase(StrLigneTmp) == 0)
{// Si mon bout de text est égale au text a remplacer
m_pBuddy->m_pTextBuffer->DeleteText(m_pBuddy,NoLigne,i,NoLigne,i + StrLenTxt,CE_ACTION_DELSEL);
m_pBuddy->m_pTextBuffer->InsertText(m_pBuddy,NoLigne,i,m_sNewText,x,y,CE_ACTION_REPLACE);
}
}
NoLigne++;
}