vendredi 27 février 2015

When using indexof and substring how do i parse the right start and end indexs ? And how do i encode hebrew chars?

I have this code:



string firstTag = "Forums2008/forumPage.aspx?forumId=";
string endTag = "</a>";
index = forums.IndexOf(firstTag, index1);

if (index == -1)
continue;

var secondIndex = forums.IndexOf(endTag, index);

result = forums.Substring(index + firstTag.Length + 12, secondIndex - (index + firstTag.Length - 50));


The string i want to extract from is for example:



<a href="/Forums2008/forumPage.aspx?forumId=317" title="הנקה">הנקה</a>


What i want to get is the word after the title only this: הנקה And the second problem is that when i'm extracting it i see instead hebrew some gibrish like this: ������


Aucun commentaire:

Enregistrer un commentaire