Extract Anchor tag from source

CodeKeep C# Feed Maggio 7th, 2008

Description: This code is used to extract any tag from the HTML source.

Link: http://www.codekeep.net/snippets/540a0ee3-d816-42dc-aa6f-4fff23eb23fe.aspx

private string ExtractAnchor(string strAStream)
    {
        string strAnchor = "";
        string arrAnchor = "";
        int aIndex = strAStream.ToLower().IndexOf("<a");
        while (aIndex != -1)
        {
            strAStream = strAStream.Substring(strAStream.ToLower().IndexOf("<a"));

            strAnchor = strAStream.Substring(0, strAStream.ToLower().IndexOf(">") + ">".Length);

            strAStream = strAStream.Substring(strAStream.ToLower().IndexOf(">") + ">".Length);
            aIndex = strAStream.IndexOf("<a");

            arrAnchor += arrAnchor + ", ";
        }
        return arrAnchor;
    }

  • .NET
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Comments are closed.

Trackback URI |