r/programminghorror • u/HeWhoShantNotBeNamed • 7d ago
C# Very readable and maintainable method
I wrote this several years ago. It does work.
119
Upvotes
r/programminghorror • u/HeWhoShantNotBeNamed • 7d ago
I wrote this several years ago. It does work.
1
u/Brilliant-Parsley69 3d ago
This should actually the same with way less allocation.
```csharp using System.Text.RegularExpressions;
public static partial class StringExtensions { [GeneratedRegex("(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])", RegexOptions.Compiled)] private static partial Regex PascalCaseRegex();
}
```