קצת הסתבכתי...

Morani1980

New member
קצת הסתבכתי...

היי.. איך אני קוראת דף, HTML לצורך העניין, ומתחילה לסרוק אותו תו אחר תו? בגדול, אני צריכה לקרוא מסמכי HTML , לסנן מילים שהן תג, ולשמור במערך את המילים במסמך. אני יודעת שצריך להשתמש ב- Streamreader, אך אין לי כ"כ מושג, כיצד... מודה לכל העוזרים..
 
בבקשה

זו דוגמה לחילוץ תגים: http://www.codeproject.com/aspnet/TagExtractor.asp ניתן לשפץ אותה קצת אם להשתמש בString.Trim פה ושם, בגדול את תמצאי עוד דוגמאות בתוצאות גוגל. לגבי קריאה מקובץ תקחי את זה כבסיס (רק בFramework 2.0, נלקח מMSDN)
Imports System Imports System.IO Public Class Test Public Shared Sub Main() Dim path As String = "c:\temp\MyTest.txt" Dim sw As StreamWriter ' This text is added only once to the file. If File.Exists(path) = False Then ' Create a file to write to. Dim createText As String = "Hello and Welcome" + Environment.NewLine File.WriteAllText(path, createText) End If ' This text is always added, making the file longer over time ' if it is not deleted. Dim appendText As String = "This is extra text" + Environment.NewLine File.AppendAllText(path, appendText) ' Open the file to read from. Dim readText As String = File.ReadAllText(path) Console.WriteLine(readText) End Sub End Class​
לגבי זיהוי הקידוד של הדף את יכולה להיעזר במאמר שכתבתי בנושא (מהבלוג של ג'סטין אנג'ל).
 
למעלה