PART II
C h a p t e r 2 2 :
S t r i n g s a n d F o r m a t t i n g
669
The output is shown here:
one and one are equal.
one and ONE are not equal.
one and ONE are equal ignoring case.
one and one, too are not equal.
First part of one and one, too are equal.
one is less than two
Using The StringComparison Enumeration
In Table 22-1, notice the two
Compare( )
methods that take a parameter of type
StringComparison
. These versions are shown here:
public static int Compare(string
str1
, string
str2
, StringComparison
how
)
public static int Compare(string
str1
, int
start1
, string
str2
, int
start2
,
int
count
, StringComparison
how
)
For each version, the
how
parameter specifies how the comparison of
str1
with
str2
takes
place.
Do'stlaringiz bilan baham: |