I have a large set of strings, including many duplicates. It is important that all of the duplicates have the same casing. So this set would fail the test:
String[] strings = new String[] { "a", "A", "b", "C", "b" };
....but this test would pass:
String[] strings = new String[] { "A", "A", "b", "C", "b" };
As I iterate through each string in strings
, how can my program see that A
is a case-insensitive duplicate of a
(and thus fail), but allow the duplicate b
through?
And another option using LINQ.
Note: You can use ToUpper() or ToUpperInvariant() depending on your need.