mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-01-11 19:44:55 +00:00
string.Split(int) now returns any remaining characters in a new chunk
This commit is contained in:
@@ -122,8 +122,8 @@ namespace ICD.Common.Utils.Extensions
|
||||
if (chunkSize <= 0)
|
||||
throw new InvalidOperationException("chunkSize must be greater than 0");
|
||||
|
||||
return Enumerable.Range(0, extends.Length / chunkSize)
|
||||
.Select(i => extends.Substring(i * chunkSize, chunkSize));
|
||||
return Enumerable.Range(0, (int)Math.Ceiling(extends.Length / (double)chunkSize))
|
||||
.Select(i => extends.Substring(i * chunkSize, Math.Min(chunkSize, extends.Length - (i * chunkSize))));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user