Skip to content

Instantly share code, notes, and snippets.

@raveneer
Last active October 17, 2018 03:12
Show Gist options
  • Save raveneer/e48e8f7c15e5b9fc3ee9e396d9870630 to your computer and use it in GitHub Desktop.
Save raveneer/e48e8f7c15e5b9fc3ee9e396d9870630 to your computer and use it in GitHub Desktop.
VK's C# Extensions
/// <summary>
/// split string with chunkSize, discard remainings
/// </summary>
public static class StringExtension
{
public static IEnumerable<string> Split(this string str, int chunkSize)
{
return Enumerable.Range(0, str.Length / chunkSize)
.Select(i => str.Substring(i * chunkSize, chunkSize));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment