A workaround, instead of changing one of the strings
and removing line breaks, may implement a comparison of yours.
An example of such a comparison would be (based slightly on this response ):
// Retorna 0 se as strings forem iguais, -1 se forem diferentes
int CompareStrings(char* a, char* b);
int CompareStrings(char* a, char* b)
{
int indexA, indexB;
for(indexA = 0, indexB = 0; indexA < strlen(a) || indexB < strlen(b); ++indexA, ++indexB)
{
if(a[indexA] == '\n')
{
if(++indexA >= strlen(a))
indexA = strlen(a);
}
if(b[indexB] == '\n')
{
if(++indexB >= strlen(b))
indexB = strlen(b);
}
if((a[indexA] == '// Retorna 0 se as strings forem iguais, -1 se forem diferentes
int CompareStrings(char* a, char* b);
int CompareStrings(char* a, char* b)
{
int indexA, indexB;
for(indexA = 0, indexB = 0; indexA < strlen(a) || indexB < strlen(b); ++indexA, ++indexB)
{
if(a[indexA] == '\n')
{
if(++indexA >= strlen(a))
indexA = strlen(a);
}
if(b[indexB] == '\n')
{
if(++indexB >= strlen(b))
indexB = strlen(b);
}
if((a[indexA] == '%pre%' || b[indexB] == '%pre%') || (a[indexA] != b[indexB]))
break;
}
// Se ambos terminaram, as strings contidas são iguais.
if( a[indexA] == '%pre%' && b[indexB] == '%pre%' )
return 0;
else
return -1;
}
' || b[indexB] == '%pre%') || (a[indexA] != b[indexB]))
break;
}
// Se ambos terminaram, as strings contidas são iguais.
if( a[indexA] == '%pre%' && b[indexB] == '%pre%' )
return 0;
else
return -1;
}
Example on Ideone with tests.