mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-16 13:15:07 +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)
|
if (chunkSize <= 0)
|
||||||
throw new InvalidOperationException("chunkSize must be greater than 0");
|
throw new InvalidOperationException("chunkSize must be greater than 0");
|
||||||
|
|
||||||
return Enumerable.Range(0, extends.Length / chunkSize)
|
return Enumerable.Range(0, (int)Math.Ceiling(extends.Length / (double)chunkSize))
|
||||||
.Select(i => extends.Substring(i * chunkSize, chunkSize));
|
.Select(i => extends.Substring(i * chunkSize, Math.Min(chunkSize, extends.Length - (i * chunkSize))));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user