hi i have wrote this code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Text.RegularExpressions;
using System.Net;
using System.IO;
namespace http
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//public MatchCollection Matches(string input);
public static string StringStrip(string Text)
{
Text = Regex.Replace(Text, "<.*?>", string.Empty);
return Text;
}
private void button1_Click(object sender, EventArgs e)
{
//används för att bygga en sträng från ström
StringBuilder sb = new StringBuilder();
byte[] buf = new byte[8192];
HttpWebRequest request = (HttpWebRequest)
WebRequest.Create("http://rankswebowl.svenskidrott.se/Query.aspx?QueryParm=100|QueryRankPoints DESC,QueryAverage DESC,QueryPlace DESC||1|||||'26768-07'|||||||");
HttpWebResponse response = (HttpWebResponse)
requset.GetResponse();
Steam resStream = response.GetResponseStream();
string tempString = null;
int count = 0;
do
{
count = resStream.Read(buf, 0, buf.Length);
if (count != 0)
{
tempString = Encoding.UTF8.GetString(buf, 0, count);
sb.Append(tempString);
}
}
while (count > 0);
{
string code = StringStrip(sb.ToString());
}
}
}
}
and i wonder how to take out thing from the string, ex names. someone have an idee of how i do ??
Loading
jingePosted Nov 15, 2009, 8:22 AM
You can use regex expressions to get things from the string. Otherwise if the string fulfills somewhat format, you can split the strings to different arrays.
Eg
If the string is "Name: jinge, Age:20", you can first split it with comma as separater, then split it with colon.
string [] arr = str.split(",");
string[] subarr = arr[0].split(":");
string name = subarr[1]; // name will be assigned to jinge.
ben gotchPosted Nov 16, 2009, 11:24 AM
string [] arr = str.split(",");
string[] subarr = arr[0].split(":");
string name = subarr[1]; // name will be assigned to jinge.
eli goPosted Nov 16, 2009, 5:30 AM