摘要: View Code static void FindTwoMins(int[] intArr, ref int firstMin, ref int secondMin) { if (intArr == null || intArr.Length <2) { throw new Exception("Input array can't be empty or less than 2"); } if (intArr[0]> intArr[1]) ... 阅读全文
posted @ 2011-09-21 15:58 Ligeance 阅读(742) 评论(0) 推荐(0) 编辑
摘要: static string ReplaceChar(string str, char chr1, char chr2) { if (str == null || str == string.Empty) { throw new Exception("String input can not be null"); } string result = ""; for (int i = 0; i < str.Length; i++)... 阅读全文
posted @ 2011-09-21 15:34 Ligeance 阅读(11209) 评论(0) 推荐(0) 编辑
摘要: static string ReverseString(string str) { if (str == null || str.Length <= 1) { return str; } string result = ""; for (int i = str.Length - 1; i >= 0; i--) { result += str[i]; } ... 阅读全文
posted @ 2011-09-21 15:25 Ligeance 阅读(346) 评论(0) 推荐(0) 编辑