Answers for "c# string reverse"

C#
58

javascript reverse a string

function reverseString(s){
    return s.split("").reverse().join("");
}
reverseString("Hello");//"olleH"
Posted by: Guest on August-05-2019
16

c# reverse string

public static string ReverseString(string s)
    {
        char[] arr = s.ToCharArray();
        Array.Reverse(arr);
        return new string(arr);
    }
Posted by: Guest on April-07-2020
3

c# reverse a string

public static void Main(string[] args)
        {
            string s = "aeiouXYZ";
           Console.Write(Reverse(s) );
        }

        public static string Reverse(string s)
        {
            var result = new string(s.ToCharArray().Reverse().ToArray() );
            return result;
        }
------------------------------------------------------Option 2
foreach (int v in values.Select(x => x).Reverse())
{
      Console.Write(v + " ");
}
Posted by: Guest on June-16-2020
1

reverse string 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"
Posted by: Guest on April-25-2020
1

c# reverse array

using System;
namespace Demo {
   class MyArray {
      static void Main(string[] args) {
         int[] list = { 29, 15, 30, 98};
         int[] temp = list;
         Console.Write("Original Array: ");
         foreach (int i in list) {
            Console.Write(i + " ");
         }
         Console.WriteLine();
         // reverse the array
         Array.Reverse(temp);
         Console.Write("Reversed Array: ");
         foreach (int i in temp) {
            Console.Write(i + " ");
         }
         Console.ReadKey();
      }
   }
}
Posted by: Guest on March-13-2020
0

c# string reverse

static class StringExtensions
{
public static string Reverse(this string metin)
{
return new string(metin.ToCharArray().Reverse().ToArray());
}
}
Posted by: Guest on October-08-2021

C# Answers by Framework

Browse Popular Code Answers by Language