logo CodeStepByStep logo

SwitchPairs

Language/Type: C# string return
Related Links:

Write a method named SwitchPairs that accepts a string as a parameter and returns that string with each pair of neighboring letters reversed. If the string has an odd number of letters, the last letter should not be modified. For example, the call SwitchPairs("example") should return "xemalpe" and the call SwitchPairs("hello there") should return "ehll ohtree".

Method: Write a C# method as described, not a complete program or class.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.