字符串反转
class Program { static void Main(string[] args) { RevertStr(); Console.Read(); } public static void RevertStr() { string str = "I_am_a_student"; string newStr = ""; string[] str1 = str.Split('_'); for (int i = str1.Length-1; i >=0; i--) { newStr += str1[i] + "_"; } Console.WriteLine(newStr.Substring(0,newStr.LastIndexOf('_'))); } }
生命不息,奋斗不止