-2

I'm having two string.

  1. string
  2. StriNG

Compare these two string and the result should be TRUE (ie,) both the string are same.

Thanks In Advance..

prabhuK2k
  • 2,188
  • 1
  • 19
  • 20

1 Answers1

4

In .NET strings are case-sensitive, so "string" is different from "String", or whatever. If you want to ignore lowercase and uppercase differences use:

string.Compare(strA, strB, true);

This will return an int (-1, 0, 1). If you want a boolean instead just use:

string.Equals(strA, strB, StringComparison.OrdinalIgnoreCase); // or InvariantCultureIgnoreCase, CurrentCultureIgnoreCase

Anyway it results a bit difficult to understand what you are asking in this question. I hope I have guessed what you wanted to know.

as-cii
  • 12,819
  • 4
  • 41
  • 43