myString=
I want to extract the text between and
and also the text between
in two different arrays.
How to do this, please help me. if anyone have code or any helpfull link please reply back.
Thanks
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Dimitrije MisicPosted Aug 8, 2008, 4:54 AM
ArrayList links = new ArrayList();
int e = 0; int linkStartPos = 0; int linkEndPos = 0; int s = 0;
while ((linkStartPos >= 0) & (linkEndPos >= 0))
{
linkStartPos = myString.IndexOf("", s, StringComparison.CurrentCultureIgnoreCase);
if (linkStartPos >= 0) linkStartPos = linkStartPos + 6;
linkEndPos = myString.IndexOf("", e, StringComparison.CurrentCultureIgnoreCase);
if ((linkStartPos >= 0) & (linkEndPos >= 0)) links.Add(myString.Substring(linkStartPos, linkEndPos - linkStartPos));
s = linkStartPos; e = linkEndPos + 7;
}
the title part is pretty much the same.
Andy TirtajayaPosted Aug 8, 2008, 4:28 AM
string tagToBeSplit = "
this is the string to be written
";Response.Write(tagToBeSplit.Split(new string[2]{ "
","
" }, StringSplitOptions.RemoveEmptyEntries)[0]);