Add separator to string at every N characters?
✔ Recommended Answer
Regex.Replace(myString, ".{8}", "$0,");
If you want an array of eight-character strings, then the following is probably easier:
Regex.Split(myString, "(?<=^(.{8})+)");
which will split the string only at points where a multiple of eight characters precede it.
Source: stackoverflow.com
Answered By: Joey
Comments
Post a Comment