Skip to content

Conversation

@mohammedbakri123
Copy link

@mohammedbakri123 mohammedbakri123 commented Jan 8, 2026

Fixes #1658

Problem

ToTitleCase does not capitalize the first word of a sentence when that word is an article, conjunction, or preposition.

Solution

Capitalize words at sentence boundaries (start of string or after ., !, ?) while preserving existing TitleCase rules for other positions.

Tests

  • dotnet test --project Humanizer.Tests --framework net10.0

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5568efc216

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +96 to +100
{
continue;
}

return ch is '.' or '!' or '?';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Treat words after closing quotes/parens as sentence starts

The new sentence-start detection only looks at the first non-whitespace character before the word, so if a sentence ends with punctuation followed by a closing quote or parenthesis (e.g., "Hello." the or "Hello." (the ...)) the previous non-whitespace character becomes "/), not ., !, or ?. In those cases IsSentenceStart returns false and articles/conjunctions/prepositions right after a real sentence boundary remain lowercase, which regresses the intended behavior for quoted or parenthesized sentences.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TitleCase does not capitalize the first word if the first word is an article, conjunction, or preposition.

1 participant