We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 0841f8c + c59f4fd commit 0dfef84Copy full SHA for 0dfef84
Matterhook.NET.MatterhookClient/StringSplitter.cs
@@ -18,7 +18,8 @@ public class StringSplitter
18
/// <returns></returns>
19
public static IEnumerable<string> SplitTextIntoChunks(string str, int maxChunkSize, bool preserveWords = true)
20
{
21
- if (string.IsNullOrEmpty(str)) throw new ArgumentException("Text can't be null or empty",nameof(str));
+ if (string.IsNullOrEmpty(str)) throw new ArgumentException("Text can't be null or empty.", nameof(str));
22
+ if (maxChunkSize < 1) throw new ArgumentException("Max. chunk size must be at least 1 char.", nameof(maxChunkSize));
23
if (str.Length < maxChunkSize) yield return str;
24
else if (preserveWords)
25
0 commit comments