Is there a way to change “ABCDEFGHIJKLMNOP” to “ABCD-EFGH-IJKL-MNOP” using string.format() function or perhaps LINQ ?
I am using this statement
Out= String.Format("{0}-{1}", String.Format("{0}-{1}-{2}", In.Substring(0, 4), In.Substring(4, 4), In.Substring(8, 4)), In.Substring(12, 4));
is there a better and clearer way to accomplish this?
You could use
string.Format, but you would still have to useSubStringto get the different parts.You should probably just use
Insert:LINQ is overkill for something like this.