Created
February 23, 2015 21:23
-
-
Save carmichaelalonso/c9190e4ad987b1f19aea to your computer and use it in GitHub Desktop.
Adding a whitespace at every 5th char
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; | |
using System.Text; | |
namespace Sample { | |
public class SampleClass { | |
public static void AddWhitespace () { | |
var InputString = "Liket hisln eedhe lpwit his"; | |
for (int i = 0; i < InputString.Length; i++) { | |
if (i % 5 == 0) { | |
//is a multiple of 5 | |
InputString.Insert(i, " "); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment