Consider a string made of only digits How do you swap every
Consider a string made of only digits. How do you swap every pair of adjacent digits? For example if the input string is \"234572379\" the result should be \"325427739\".
**JAVASCRIPT Help
Solution
string input = \"234572379\";
StringBuilder outpt = new StringBuilder();
char[] chrs = input.ToCharArray();
for (int i = 0; i < chrs.Length; i++)
{
if (i % 2 == 0)
{
if((i+1) < chrs.Length )
{
outpt.Append(chrs[i + 1]);
}
outpt.Append(chrs[i]);
}
}
