Re: problem with string.Contains()



Contains is case sensitive. You will have to try something like:

string myString = "<Table><TR><TD></TD></TR></Table>";

if (myString.ToUpper().Contains("</TABLE>"))
{
Console.WriteLine("Found it.");
}

or you could use regular expressions.


"Christopher Van Kirk" <chris.vankirk@xxxxxxxxxxxx> wrote in message news:7u7ct3d59gd149dlvi0lfmpnou5dh91a1t@xxxxxxxxxx
On Mon, 10 Mar 2008 15:53:28 +0100, "Jeff" <no_email_address> wrote:

Hey

.NET 3.5

I'm trying to search a string to determine if the string contains </table>,
but string.Contains don't find it. I've used WebRequest/WebReponse to
retrieve the html from a webpage and now I'm searching through this html...
this webpage contains 4 html tables. so there are 4 </table>, but my code
don't find any...

Here is part of my code, this if-statment don't get true...
string line;
if (line.Contains(" </table>" ))
{
boolean = false;
}

any suggestions?


Check that you haven't put \t instead of /t.


--
Posted via a free Usenet account from http://www.teranews.com


.



Relevant Pages

  • Re: getAttribute question
    ... oddity with IE that getAttributereturns an empty string if the ... HTML specification, ... appropriate places in the HTML 4 and DOM HTML specifications. ...
    (comp.lang.javascript)
  • Re: [PHP] generating an html intro text ...
    ... You would have to search out and pull in all closing tags. ... grab 256 characters -- The string. ... html markup should not go towards the string length count, ...
    (php.general)
  • [perl-python] 20050127 traverse a dir
    ... suppose you want to walk into a directory, say, to apply a string ... replacement to all html files. ... So, when ever myfun is called, we need to loop thru the ... # with a recursive "filter" ...
    (comp.lang.perl.misc)
  • [perl-python] 20050127 traverse a dir
    ... suppose you want to walk into a directory, say, to apply a string ... replacement to all html files. ... So, when ever myfun is called, we need to loop thru the ... # with a recursive "filter" ...
    (comp.lang.python)
  • Re: Suppress viewstate __viewstate rendering
    ... // at this point sb.ToString() contains a string of everything in that panel. ... I don't know that the HTML of the page can be ... > controls that make up a timesheet entry/report page. ... >>> is empty, so the HTML renders ...
    (microsoft.public.dotnet.framework.aspnet)