private static string bb(string a) { string b = string.Empty; for (int i = 0; i < a.Length; i++) { b += a.Substring(a.Length - i - 1, 1); } return b; }
Console.WriteLine("请输入内容"); string read = Console.ReadLine().ToString(); for (int i = read.Length - 1; i > -1; i--) { Console.Write(read[i]); }
public void JudgeCommand() { string str = "123"; StringBuilder a = new StringBuilder(); for(int i=str.Length-1;i>=0;i--) { a.Append(str[i]); }
MessageBox.Show(a.ToString()); }
Stack 类 表示对象的简单的后进先出非泛型集合。 命名空间: System.Collections http://msdn.microsoft.com/zh-cn/library/system.collections.stack(VS.80).aspx http://msdn.microsoft.com/zh-cn/library/system.collections.stack_members(VS.80).aspxStack myStack = new Stack(); myStack.Push("Hello"); myStack.Push("World"); myStack.Push("!");/* This code produces the following output. myStack Count: 3 Values: ! World Hello */
using System; using System.Collections.Generic; using System.Text;namespace ConsoleApplication3 { class Program { static void Main(string[] args) { string re = Console.ReadLine(); for (int i = 0; i < re.Length; i++) { Console.Write(re[re.Length - i-1]); } Console.ReadLine(); } } }
{
string b = string.Empty;
for (int i = 0; i < a.Length; i++)
{
b += a.Substring(a.Length - i - 1, 1);
}
return b;
}
string read = Console.ReadLine().ToString();
for (int i = read.Length - 1; i > -1; i--)
{
Console.Write(read[i]);
}
{
string str = "123";
StringBuilder a = new StringBuilder();
for(int i=str.Length-1;i>=0;i--)
{
a.Append(str[i]);
}
MessageBox.Show(a.ToString());
}
表示对象的简单的后进先出非泛型集合。
命名空间: System.Collections
http://msdn.microsoft.com/zh-cn/library/system.collections.stack(VS.80).aspx
http://msdn.microsoft.com/zh-cn/library/system.collections.stack_members(VS.80).aspxStack myStack = new Stack();
myStack.Push("Hello");
myStack.Push("World");
myStack.Push("!");/*
This code produces the following output.
myStack
Count: 3
Values: ! World Hello
*/
using System.Collections.Generic;
using System.Text;namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
string re = Console.ReadLine();
for (int i = 0; i < re.Length; i++)
{
Console.Write(re[re.Length - i-1]);
}
Console.ReadLine();
}
}
}