Ok so here's the deal, you want to swap the characters if the string exists out of an odd number of characters (3), so ABC becomes CBA, and if it's an even number (2), it stays the same AB becomes AB. And if the string contains more than 3 characters, you want it to split it up in as many "3" character strings as you can and swap again, so in case of a 10-character string it needs to chop it in 3 seperate strings of 3 and 1 string of 1 character. Am I correct?
So first you need to check if the string contains either 2 or 3 characters or more. You would want to write a method for it. I'm not known with C# so I'll do it in java.
Code:
/*
* Method which checks if the string consists out of more than 3 characters
*/
public static boolean moreThanThree(String myString) {
int strl = myString.length();
if (strl > 3) {
return true;
}
else {
return false;
}
}
Ok now you have to write a method which swaps the contents of the string, I could do this in java, but I think you'll have a hard time converting it to C# since you're new to the language... It would be rather equal to the code which is given earlier.