For Programmers: Free Programming Magazines  


Home > Archive > C# > June 2004 > Easy one - string/char comparison









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Easy one - string/char comparison
Curious Student

2004-06-03, 7:31 pm

I need to compare two character array elements to see if they have the
same value, but using a text compare rather than a binary compare of
the scan codes. I want to do what VB's Option Compare Text does rather
than Option Compare Binary, which is what I am seeing as a result of
this comparison:

code:
------------
if (s==s[j])
------------

For instance if the ith element contains the character P and the jth
element contains p, then they [i]must be equal and this if condition
must return true.
Eric Means

2004-06-03, 7:31 pm

estudiantin@rediffmail.com (Curious Student) wrote in message news:<c520b56a.0405290548.6f1db421@posting.google.com>...
> For instance if the ith element contains the character P and the jth
> element contains p, then they [i]must be equal and this if condition
> must return true.


Try this:

code:
------------
if (s.ToUpper()==s[j].ToUpper())
------------
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com