Instead of trying to be clever, I'd write a simple extension method that is infinitely more usable:
public static string InsertCharacter(this string str, int pos, char ch)
{
int lastInsert = 0;
string insertChar = new string(new char[]{ch});
while (true)
{
if (str.Length - lastInsert > pos)
{
lastInsert += (lastInsert == 0) ? pos : pos+1;
str = str.Insert(lastInsert, insertChar);
}
else
{
break;
}
}
return str;
}
Usage:
string mystring = "abcdefghijklmnop";
mystring = myString.InsertCharacter(4, '-');
I'm old and often don't remember why I do stuff, much less the whats/wheres/whys of code I wrote, so the clever stuff is wasted on me.