Created
September 17, 2019 09:58
-
-
Save inertiave/b1b9efc8a3b73deda9cd0dad4b3cac8e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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