logo CodeStepByStep logo

SwitchPairs

Language/Type: VB string return

Write a function 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".

Function: Write a VB function as described, not a complete program.

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.