Home
Manage Your Code
Snippet: Extract Anchor tag from source (C#)
Title: Extract Anchor tag from source Language: C#
Description: This code is used to extract any tag from the HTML source. Views: 143
Author: Dhaval Patel Date Added: 5/6/2008
Copy Code  
1private string ExtractAnchor(string strAStream)
2    {
3        string strAnchor = "";
4        string arrAnchor = "";
5        int aIndex = strAStream.ToLower().IndexOf("<a");
6        while (aIndex != -1)
7        {
8            strAStream = strAStream.Substring(strAStream.ToLower().IndexOf("<a"));
9
10            strAnchor = strAStream.Substring(0, strAStream.ToLower().IndexOf(">") + ">".Length);
11
12            strAStream = strAStream.Substring(strAStream.ToLower().IndexOf(">") + ">".Length);
13            aIndex = strAStream.IndexOf("<a");
14
15            arrAnchor += arrAnchor + ", ";
16        }
17        return arrAnchor;
18    }