473,507 Members | 2,388 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem with string.Contains()

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?
Mar 10 '08 #1
4 10249
Might also want to check the source to see if it uses some other
casing: TABLE, Table, tAbLe, etc... depending on your conformance,
anything is possible...
Mar 10 '08 #2
I've just found out why this didn't work. My mistake... the reason if
(line.Contains("</table>" )) didn't work, was because there is another
if-statement above this and that if statement wasn't true... so I've solved
it.

"Jeff" <no_email_addresswrote in message
news:Od**************@TK2MSFTNGP03.phx.gbl...
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?

Mar 10 '08 #3
On Mon, 10 Mar 2008 15:53:28 +0100, "Jeff" <no_email_addresswrote:
>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

Mar 14 '08 #4
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" <ch***********@fdcjapan.comwrote in message
news:7u********************************@4ax.com...
On Mon, 10 Mar 2008 15:53:28 +0100, "Jeff" <no_email_addresswrote:
>>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
Mar 15 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3910
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
0
1632
by: Tim::.. | last post by:
Hi... I'm having a big problem with a datagrid that obtains data from 2 different locations... Active Directory and SQL Database The data is inserted into a datatable and the sorted by a...
1
3877
by: tangus via DotNetMonster.com | last post by:
Hello all, I'm really struggling with getting some Active Directory code to work in ASP.NET. Can you please provide assistance? I am executing the following code: Dim enTry As DirectoryEntry =...
12
1572
by: Peter Proost | last post by:
Hi group, I've got what seems a simple problem, but I can't find the solution. I've got a textbox and a handheld scanner to scan barcodes, the scanner just generates keypresses like a keyboard...
2
4427
by: ajikoe | last post by:
Hi, I tried to follow the example in swig homepage. I found error which I don't understand. I use bcc32, I already include directory where my python.h exist in bcc32.cfg. /* File : example.c...
9
8146
by: philip | last post by:
If I execute that : Dim Temp as string = "This is a text" Dim sw As StreamWriter Dim fullFileName as string = "c:\text.txt" sw = New StreamWriter(fullFilename) sw.Write(temp) sw.Close() ...
8
11970
by: Chris Noble | last post by:
I need to check whether a particular user is already a member of an Active Directory Security Group. The following code extract works but only if the user distinguished name is exactly the same...
15
1914
by: iu2 | last post by:
Hi all, can someone help me with this? I'm trying to shorthen some logging function in our project, i.e., instead of LogString("...); use a more convenient log() << "String here " <<...
11
2060
by: =?ISO-8859-1?Q?Jean=2DFran=E7ois_Michaud?= | last post by:
Context: I'm trying to compare XML tree fragments and I'm doing so by outputting the attributes of each element in the tree and outputting it to a string then normalizing the strings. Then I'm...
1
1991
by: Jon Skeet [C# MVP] | last post by:
On Apr 30, 3:56 pm, Raja <rajesh.mad...@gmail.comwrote: Well, in fact it's *not* working fine - it's not behaving the same on SQL server as it would be in normal code. String.Contains is case-...
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7111
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7319
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1542
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
760
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.