> On Oct 12, 2021, at 10:30 AM, Shaozhong SHI <shishaozhong@gmail.com> wrote: > > I tried initcap and found a major problem with it. > > Initcap of notemachine is NoteMachine. My version 12 system gives Notemachine > > Initcap of Sainsbury's Bank is Sainsbury'S bank. > > This is not expected. > > Anyway to get around this problem? >
Pg v.13 doesn't have a problem with notemachine either, but does seem to screw up Sainsbury's Bank as Sainsbury'S bank.
The only way I could think of fixing this would be to swap out the apostrophe with an alpha string not present in the string, and then swap back when you're done (see example above -- I'm not recommending using "xyzxyz" - that's just an example. And ideally you'd search for your placeholder string first to be sure it doesn't exist, or escape it).
Or just use a regexp to solve your casing problem -- maybe break up your string by whitespace into array elements, uppercase the first letter of each array and the concat the array elements back?