Hey, I'm using C# with Selenium and was wondering if you can tell a program in C# Sharp to reverse a string?

Hey, I’m using C# with Selenium and was wondering if you can tell a program in C# Sharp to reverse a string?at LambdaTest?

Hi Joe-elmoufak,

Here is the snippet:

internal static void ReverseString(string str) 
{ 
   
  char[] charArray = str.ToCharArray(); 
  for (int i = 0, j = str.Length - 1; i < j; i++, j--) 
  { 
      charArray[i] = str[j]; 
      charArray[j] = str[i]; 
  } 
  string reversedstring = new string(charArray); 
  Console.WriteLine(reversedstring);