public static bool has_Duplicates(string str)
{
str = str.ToLower(); // Lowercase all the items, makes them easier to sort
int length = str.Length; // Get the length to apply to array
char[] strArray = str.ToCharArray();
// Turn to a character array
Array.Sort(strArray);
// Sort for speed and for method loop to work
// Begin for loop to sort through letters
for (int i = 0; i < length - 1; i++)
{
if (strArray[i] == strArray[i + 1])
{
//if letter equals next letter, False
Console.WriteLine(str + "has duplicates");
return false;
}
}
// if letter != next letter, Pass as True
Console.WriteLine(str + "has no duplicates");
return true;
}