Created
January 3, 2022 22:18
-
-
Save jbollman7/b3cb5ffd72e15f2070418c8e6931aea9 to your computer and use it in GitHub Desktop.
Split Join JS to C# equivalent.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log(readline().split(' ').reverse().join(' ')); //JS taking string input, splitting on whitespace, reversing the order of the string array, and joining the array back to a single string. | |
//Below is the c# equivalent | |
var t = input.Split(' ').Reverse(); | |
var reversedstring = String.Join(' ', t); //Join is a static method, so I cannot chain like JS. | |
Console.WriteLine(reversedstring); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment