public static StringBuilder FindDuplicateChar(string value)
{ StringBuilder result = new StringBuilder();
StringBuilder duplicateChar = new StringBuilder();
foreach (var item in value)
{ if (result.ToString().IndexOf(item.ToString().ToLower()) == -1)
{ result.Append(item);}
else
{ duplicateChar.Append(item);}
}
// return duplicateChar; // Use for Duplicate
// return result ; // Use for unique
}
No comments:
Post a Comment