Click here to Skip to main content
16,021,211 members

Comments by Nageshwarraok (Top 4 by date)

Nageshwarraok 24-Jan-11 2:12am View    
I have not changed your code much. Only the part of your code
foreach (coll col in list)
{
HTMLStr = HTMLStr.Remove(col.POS, col.TAG.Length);
}
changed to
int tagLength = 0;
foreach (coll col in list)
{
HTMLStr = HTMLStr.Remove((col.POS - tagLength), col.TAG.Length);
tagLength = tagLength + col.TAG.Length;
}
I am updating position on each removal of tag from the original string.

Thank you

Regards
NageshwarRao Kolagani
Nageshwarraok 24-Jan-11 1:54am View    
Hi Hiren Solanki,

Thank you so much. your code/logic helps me a lot.

Thank You,

Regards
NageshwarRao Kolagani.
Nageshwarraok 24-Jan-11 1:49am View    
Hi Hiren Solanki,

But following code removing from original string only.

foreach (coll col in list)
{
HTMLStr = HTMLStr.Remove(col.POS, col.TAG.Length);
}

Thank you

Regards

NageshwarRao Kolagani
Nageshwarraok 24-Jan-11 1:38am View    
Hi Hiren Solanki,
Thank you for your valuable code i will appreciate your logic.small suggestion :
Your code is perfect till you collect tags which are not having ending tags. But problem occurs when u remove opening tags which are not having closing tags.
Problem occurs when, every time you remove an item from string. you have to update position accordingly on each remove. like:

int length = 0;
foreach (coll col in list)
{
HTMLStr = HTMLStr.Remove((col.POS - length) , col.TAG.Length);
length =length+ col.TAG.Length;
}


Thank you

Regards
NageshwarRao Kolagani