Answers for "C# a program to reverse each word in the given string."

C#
0

C# a program to reverse each word in the given string.

var reversedWords = string.Join(" ",
      str.Split(' ')
         .Select(x => new String(x.Reverse().ToArray())));
Posted by: Guest on February-25-2021
0

C# a program to reverse each word in the given string.

string str = "I am going to reverse myself.";
  string strrev = "";

  foreach (var word in str.Split(' '))
  {
     string temp = "";
     foreach (var ch in word.ToCharArray())
     {
         temp = ch + temp;
     }
     strrev = strrev + temp + "";
  }
  Console.WriteLine(strrev);  //I ma gniog ot esrever .flesym
Posted by: Guest on February-25-2021
0

C# a program to reverse each word in the given string.

new String( word.Reverse().ToArray() )
Posted by: Guest on February-25-2021
0

C# a program to reverse each word in the given string.

var reversedWords = string.Join(" ",
      str.Split(' ')
         .Select(x => new String(x.Reverse().ToArray()))
         .ToArray());
Posted by: Guest on February-25-2021

Code answers related to "C# a program to reverse each word in the given string."

C# Answers by Framework

Browse Popular Code Answers by Language