1. You can split (separate) a string into sub-strings when you now the separators chars (spaces, coma, etc), and in that case you should use the
string.Split()
method like is indicated in "Solution 1" above.
2.But in your case you have a set of concatenated words with no separators between them.
In this case you should provide some rule that could be used for splitting, like in your case all words from the string has the same length (8 chars). So if you have this rule the the solution is the next one:
string input = "usernameemail_idpassword";
int length = 8;
int n = input.Length;
StringBuilder temp = new StringBuilder();
for(int i=0; i< n; i+=length)
{
if (i > 0)
{
temp.Append(",");
}
temp.Append(input.Substring(i, length));
}
string result = temp.ToString();
Console.WriteLine(result);