示例#1
0
        /// <summary>
        /// finds and returns first duplicate character in string
        /// </summary>
        /// <param name="arr">array of items</param>
        /// <returns>first duplicate item</returns>
        public static char FindDuplicate(string str)
        {
            Tuple <string, char> result = ArrayProblems <char> .FindDuplicate(str.ToCharArray());

            return(result.Item1 == "found" ? result.Item2 : ' ');
        }
示例#2
0
 /// <summary>
 /// reverses input string
 /// </summary>
 /// <param name="str">string - can be empty or one or more characters</param>
 /// <returns>reversed string</returns>
 public static string ReverseString(string str)
 {
     return(new string(ArrayProblems <char> .ReverseArray(str.ToCharArray())));
 }