I'm having the string value 740D1E11625C89019E61D0CC I want to insert "-" in string after every count 5 length.
I'm using
ReplaceAt(serial, 5, 0, "-");
public static string ReplaceAt(string str, int index, int length, string replace)
{
return str.Remove(index, Math.Min(length, str.Length - index))
.Insert(index, replace);
}
Result
740D1-E11625C89019E61D0CC
It should be
740D1-E1162-5C890-19E61-D0CC
Is this right way to modify string ?