I need to convert camelcase keys to Pascal key and I got good solution from stackoverflow.
But the issue is I don't know how to exclude . in conversion.
Please find the below example:
var input= "customer.presentAddress.streetName";
Expected Output is
var output= "Customer.PresentAddress.StreetName";
PlayGround : Please click here
An idea to use e.g. \b\p{Ll} (demo) for matching lower word's first letter and use a callback.
string output = Regex.Replace(input, @"\b\p{Ll}", match => match.Value.ToUpper());
See this C# demo at tio.run - \b is a word boundary and \p{Ll} matches lowercase letters.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With