79204167

Date: 2024-11-19 16:03:46
Score: 1
Natty:
Report link

The only mistake in your code I can see is: this method should be static. It works correctly, “S” after the apostrophe is not capitalized.

It is possible that you are reporting not exactly what you are observing, it happens. I tested the assumption made by shingo (please see comments to your questions). There are many characters similar to apostrophes, such as prime, single quotation marks, and the like. It looks like the method capitalizes a character after any punctuation except real apostrophes, and that makes sense, as any other no-space character except apostrophes would be mistakes, wrong typography/spelling.

So, the remaining question is what is the apostrophe? To test different characters, you can test it with strings like

$"Johnny{System.Char.ConvertFromUtf32(0x02BC)}s pizza"

You can try apostrophes 0x27, 0x02BC and see that they don't cause capitalization, everything works correctly.

Unfortunately, huge masses of texts carry different punctuation mistakes. For example, according to this article:

…for many years, U+2019 has also been “the preferred character for a punctuation apostrophe” in the Unicode standard. Like “smart” or “curly” quotes, writing and publishing software may mis/interpret the U+0027 character you type in a certain context as an apostrophe and change it to a U+2019.

But these practices are all wrong. The standards strictly define what is the apostrophe and what is not.

Reasons:
  • Blacklisted phrase (1): this article
  • Long answer (-1):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: Sergey A Kryukov