Can you please help me with my code as I have a trouble with the returned strings that I have extracted from my php source to add the strings in my listview.
I'm reading the tags of mystrings1 and mystrings2 for each paragraph from the php source. I got the returned strings which it looks like this:
Or, if your sample string is even closer to the real scenario, simply take the first and the last one. But if it actually would be so simple you probably wouldn't have asked...
I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.
This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.
Thanks Eri523, but your code seems to be a little bit mess. I have adjusted the code the one you have posted to be enaged with my code. It seems to be working right now.
Code:
for each (Match ^x1 in matches1)
{
array<String^> ^StrArr1 = x1->Value->ToString()->Split('|');
List<String ^> ^lstFilteredTags = gcnew List<String ^>;
for each (String ^strTag in StrArr1)
{
strTag = strTag->Trim();
if (strTag->StartsWith("<p id='mystrings1'>"))
{
lstFilteredTags->Add(strTag);
MessageBox::Show(strTag);
ListViewItem ^item1 = gcnew ListViewItem("images",1);
item1->SubItems->Add(strTag->ToString()->Replace("<p id='channels'>", "")->Replace("</p>", ""));
listView1->Items->AddRange(gcnew array<ListViewItem^> {item1});
listView1->CheckBoxes = true;
if (x1->Value->Contains("Enabled"))
{
item1->Checked = true;
}
}
}
}
Thanks Eri523, but your code seems to be a little bit mess. I have adjusted the code the one you have posted to be enaged with my code. It seems to be working right now.
I must admit that I only took a brief look at your code, since it looked too confusing and still seems to depend on lots of unknown preconditions. Instead I solely based my code on your snippets of the desired input and output strings, added the premise not to use regexes. At any rate, fine that it works now.
You probably won't have real problems incorporating that into your code, like you did it with what I posted in post #2.
Note that this is absolutely minimalistic and completely lacks any error checking. It will return nonsense or throw an exception if the input string actually doesn't contain any </p> tag.
I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.
This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.
Bookmarks