Right now I take in a string like this "112233 112233 112233 112233", and I split it into an array like this:
string text = ProcessString("112233 112233");
string[] dates = text.Split(' ');
And that works great, but I want to use string builder to build my string so they would end up like 11-22-33 11-22-33 etc.
So I did try this:
static string ProcessString(string input)
{
    StringBuilder buffer = new StringBuilder(input.Length * 3 / 2);
    for (int i = 0; i < input.Length; i++)
    {
        if ((i > 0) & (i % 2 == 0))
            buffer.Append("-");
        buffer.Append(input[i]);
    }
    return buffer.ToString();
}
It works, but it does not match the expected output of:
11-22-33 
11-22-33
My current output is:
11-22-33- 
1-12-23-3
-11-22-33
What can I do to fix this?
 
     
     
     
     
     
     
    