G wrote:
Hello,
Does anyone have any code handy which will take a certain part of a
string and save it as an independant string?
For example:
"Thank you for visiting our web site. You were sent here by Michael
Smith from Aberdeen who thought you would find this page interesting."
If I wanted to save the part "Michael Smith from Aberdeen" , how would I
go about loosing the bits on the left and right? I think in classic ASP
it was the String replace function.
Any help appreciated.
Regards,
Gary.
In the String class you have a lot of methods to manipulate strings.
This example will put together a string, then extract the referrer by
stripping off the first and last strings:
string referrer = "Michael Smith from Aberdeen";
string message1 = "Thank you for visiting our web site. You were sent
here by ";
string message2 = " who thought you would find this page interesting.";
string message = message1 + referrer + message2;
string extract = message.Substring(message1.Length, message.Length -
message1.Length - message2.Length);
--
Göran Andersson
_____
http://www.guffa.com