c#ย้อนกลับข้อความ
public static string ReverseString(string s)
{
char[] arr = s.ToCharArray();
Array.Reverse(arr);
return new string(arr);
}
ย้อนกลับข้อความ c#
string str = "Hello World!"; // the string which you want to reverse
string reverse = "";
int length = str.Length - 1;
while(length >= 0)
{
reverse += str[length];
length--;
}
Console.WriteLine(reverse); // output: "!dlroW olleH"