You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
557 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BirdyFlash.Lib {
public static class Extensions {
public static IEnumerable<string> Split(this string str, int n) {
if (String.IsNullOrEmpty(str) || n < 1) {
throw new ArgumentException();
}
for (int i = 0; i < str.Length; i += n) {
yield return str.Substring(i, Math.Min(n, str.Length - i));
}
}
}
}