about summary refs log tree commit diff
path: root/lib/Extensions.cs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Extensions.cs')
-rw-r--r--lib/Extensions.cs11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/Extensions.cs b/lib/Extensions.cs
index 52863d0..41bde69 100644
--- a/lib/Extensions.cs
+++ b/lib/Extensions.cs
@@ -11,5 +11,16 @@ namespace aoc2019.lib
             if (list.Count() == 1) return new[] { list };
             return list.SelectMany(t => Permute(list.Where(x => !x.Equals(t))), (v, p) => p.Prepend(v));
         }
+
+        public static IEnumerable<string> Chunk(this string str, int chunkSize)
+        {
+            for (int i = 0; i < str.Length; i += chunkSize)
+                yield return str.Substring(i, chunkSize);
+        }
+
+        public static string ToDelimitedString<T>(this IEnumerable<T> enumerable, string delimiter = "")
+        {
+            return string.Join(delimiter, enumerable);
+        }
     }
 }