Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

[HELP] C#: Pa suggest po mga master

ggwp01

Novice
Advanced Member
Messages
22
Reaction score
0
Points
26
May ginagawang tool ako sa trabaho gamit c#.
Ito ang current tool ko.
Magread ng html file tapos may palitan na code.
Example - sample.html
<span>sample text </span>
<span>sample dsad</span>
<span>dasdasda</span>

Output:
<span>1. sample text </span>
<span>2. sample dsad</span>
<span>3. dasdasda</span>

Problem ko ngayon ay kapag ganito ang structure ng html
<span>
sample text
</span>

Wala siyang output. Patulong naman po.:help:
 
lapag mo code mo

StreamReader sr = new StreamReader(textBox2.Text);
string line = "";
line = sr.ReadLine();
int temp = 1;
string str = new string(' ', 10);
while (line != null)
{

Regex yourRegex = new Regex(@"(?<=<span>)(.*?)(?=</span>)");
Match match = yourRegex.Match(line);
if (match.Success)
{
int pFrom = line.IndexOf("<span>") + "<span>".Length;
int pTo = line.LastIndexOf("</span>");
string result = line.Substring(pFrom, pTo - pFrom);
string replace = result.Replace(result, "REPLACE");
textBox1.AppendText("<tr>\r\n"+str+"<td>" +temp+replace.ToString()+ "</td>\r\n</tr>" + "\r\n");
line = sr.ReadLine();
temp++;
}
else
{
line = sr.ReadLine();
}


}
 
StreamReader sr = new StreamReader(textBox2.Text);
string line = "";
line = sr.ReadLine();
int temp = 1;
string str = new string(' ', 10);
while (line != null)
{

Regex yourRegex = new Regex(@"(?<=<span>)(.*?)(?=</span>)");
Match match = yourRegex.Match(line);
if (match.Success)
{
int pFrom = line.IndexOf("<span>") + "<span>".Length;
int pTo = line.LastIndexOf("</span>");
string result = line.Substring(pFrom, pTo - pFrom);
string replace = result.Replace(result, "REPLACE");
textBox1.AppendText("<tr>\r\n"+str+"<td>" +temp+replace.ToString()+ "</td>\r\n</tr>" + "\r\n");
line = sr.ReadLine();
temp++;
}
else
{
line = sr.ReadLine();
}


}


Gamitin mo StreamWriter.WriteLine
 
Back
Top Bottom