Skip to content

Commit 4fe45bf

Browse files
refactor: use Select to separate Trim transform from stateful loop body
1 parent c303331 commit 4fe45bf

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

EssentialCSharp.Chat.Shared/Services/MarkdownChunkingService.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,8 @@ public FileChunkingResult ProcessSingleMarkdownFile(
6666
// separators — stripping all blanks defeats paragraph-aware chunking.
6767
var normalizedLines = new List<string>(fileContent.Length);
6868
bool lastWasBlank = false;
69-
foreach (var raw in fileContent)
69+
foreach (var line in fileContent.Select(raw => raw.Trim()))
7070
{
71-
var line = raw.Trim();
7271
var isBlank = string.IsNullOrWhiteSpace(line);
7372
if (!isBlank || !lastWasBlank)
7473
normalizedLines.Add(line);

0 commit comments

Comments
 (0)