Jay <Ja*@discussions.microsoft.com> wrote:
Thanks Doug,
Do you happen to have a c# version of this code?..if not, thats ok!
Doug's code won't actually work. (It doesn't even compile without
modification, and needs further modification to work.)
I suggest you have a look at the answers to the same question you
posted a few days ago. Otherwise:
(with x as the string in question)
int startIndex = x.IndexOf ("<!-- start -->");
if (startIndex != -1)
{
int textStart = startIndex+14;
int endIndex = x.IndexOf("<!-- end -->", textStart);
if (endIndex != -1)
{
string result = x.Substring (startIndex, endIndex-startIndex);
}
else
{
// Whatever you want to do with no end tag
}
}
else
{
// Whatever you want to do with no start tag
}
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too