G
garyusenet
Hi All,
I have been working on the following programme over the last day or so
and have made a good deal of progress. It is a very simple programme,
but is proving very useful as a learning aid, and will eventually be
useful to me in it's own right.
It function is to open a text file, and remove HTTP addresses from the
file. The file is always in a certain format, and the HTTP address is
always proceeded by a key phrase.
So far I have got as far as opening the file and removing all the junk
before the first site is listed. What I'm trying to do now is split the
remaining string into an array. I want to use a phrase as the
delimitter and reading this forum I found a previous poster had the
same problem and someone suggested him using the Regex function.
I've tried that but am getting a result I don't understand. When I
check the size of the array the Regex function has created for me it is
far too small.
The code i'm talking about is here: -
string[] sitearray = Regex.Split(shortenedstring, "num=");
MessageBox.Show(sitearray.Length.ToString());
Now when i open the file in notepad and count the number of 'num='
occurances there are between 7-10 in each file i test. But i'm getting
arrays of sizes sometimes as low as 3.
The full code to my programme is here (it's quite a simple programme!)
http://rafb.net/paste/results/b1p5uU35.html
I look forward to your feedback,
Thankyou,
Gary.
I have been working on the following programme over the last day or so
and have made a good deal of progress. It is a very simple programme,
but is proving very useful as a learning aid, and will eventually be
useful to me in it's own right.
It function is to open a text file, and remove HTTP addresses from the
file. The file is always in a certain format, and the HTTP address is
always proceeded by a key phrase.
So far I have got as far as opening the file and removing all the junk
before the first site is listed. What I'm trying to do now is split the
remaining string into an array. I want to use a phrase as the
delimitter and reading this forum I found a previous poster had the
same problem and someone suggested him using the Regex function.
I've tried that but am getting a result I don't understand. When I
check the size of the array the Regex function has created for me it is
far too small.
The code i'm talking about is here: -
string[] sitearray = Regex.Split(shortenedstring, "num=");
MessageBox.Show(sitearray.Length.ToString());
Now when i open the file in notepad and count the number of 'num='
occurances there are between 7-10 in each file i test. But i'm getting
arrays of sizes sometimes as low as 3.
The full code to my programme is here (it's quite a simple programme!)
http://rafb.net/paste/results/b1p5uU35.html
I look forward to your feedback,
Thankyou,
Gary.