Skip to content

Instantly share code, notes, and snippets.

@carmichaelalonso
Created February 23, 2015 21:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carmichaelalonso/c9190e4ad987b1f19aea to your computer and use it in GitHub Desktop.
Save carmichaelalonso/c9190e4ad987b1f19aea to your computer and use it in GitHub Desktop.
Adding a whitespace at every 5th char
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