I had to do something similar, trying to convert a string of numbers to a period of time by adding in : and . . I basically took 235959999 and had to convert it to 23: 59: 59.999. It was easy for me, because I knew where I needed to "insert" the specified characters.
ts = ts.Insert(6,"."); ts = ts.Insert(4,":"); ts = ts.Insert(2,":");
Basically reassigning ts to itself with a character inserted. I made my way from the back to the front because I was lazy and did not want to do additional math for the other characters inserted.
You can try something like this by doing:
alpha = alpha.Insert(5,"-"); alpha = alpha.Insert(11,"-"); //add 1 to account for 1 - alpha = alpha.Insert(17,"-"); //add 2 to account for 2 - ...
Nocfenix
source share