Skip to content

Instantly share code, notes, and snippets.

@inertiave
Created September 17, 2019 09:58
Show Gist options
  • Save inertiave/b1b9efc8a3b73deda9cd0dad4b3cac8e to your computer and use it in GitHub Desktop.
Save inertiave/b1b9efc8a3b73deda9cd0dad4b3cac8e to your computer and use it in GitHub Desktop.
using System.Text;
public class MyStringExtension {
public string InjectComma(string input)
{
StringBuilder sb = new StringBuilder(input.Length * 2);
for (int i = 0; i < input.Length; i++) {
sb.Append(input[i]);
if (i % 5 == 4) {
sb.Append(",");
}
}
return sb.ToString();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment