JustAskMe
asked on
split web respose c#
I Want to split the respose that for each "<td><a class="; it should give me a new string
my code doesn't work...
any idea?
my code doesn't work...
any idea?
string D = "<td><a class=";
char[] delimiter = D.ToCharArray();
string[] SL = Response.Split(delimiter);
int I = 0;
string S = "";
foreach (string S1 in SL)
{
if (S1.Contains("vcard.php?city="))
{
S = S1;
break; // TODO: might not be correct. Was : Exit For
}
I = +1;
}
opps sorry stringSplit should be intialized string.Empty not ""
ASKER
Same error: Error 1 The best overloaded method match for 'string.Split(params char[])' has some invalid arguments
ASKER
also another errrr can not convert from string to char
ASKER
Error 2 Argument '1': cannot convert from 'string' to 'char[]'
my apologies its abit early for me the issue is that when converting the delimiter string to char array it separates each character which is not what you want my understanding of what you want seems to be that your checking for values and if they are present you wish to store in a string ie:
if (item.Contains("vcard.php? city="))
{
stringSplit = item;
break;
}
could you please elaborate further as to what your trying to achieve so perhaps i can suggest an alternative method to implementing it.
if (item.Contains("vcard.php?
{
stringSplit = item;
break;
}
could you please elaborate further as to what your trying to achieve so perhaps i can suggest an alternative method to implementing it.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
there is no need for the variable i, and while your splitting your delimiinter it will never step into your if statement.
Open in new window