Re: Feature request for INITCAP() function - Mailing list pgsql-general

From Daniel Verite
Subject Re: Feature request for INITCAP() function
Date
Msg-id c7ecbe59-9a76-4e54-ae85-b0dd95c19cab@manitou-mail.org
Whole thread Raw
In response to Feature request for INITCAP() function  (Jeff Gerbracht <jeffgerbracht@gmail.com>)
List pgsql-general
    Jeff Gerbracht wrote:

> It would be great if there was a way to set exceptions to the 'word'
> delimiter list used in the INITCAP() function.    For example, I have
> hyphenated words like blue-green or possessives and contractions like
> don't and cat's tail
> These become Blue-Green, Don'T and Cat'S Tail.

An ICU collation may produce better results for this:

select initcap('blue-green don''t cat''s tail' COLLATE "en-x-icu");
       initcap
-----------------------------
 Blue-Green Don't Cat's Tail

With hyphens, it's not clear what the results should be.
Looking at the IMDb movies database [1] for instance, titles have
a mix of upper and lower case following the hyphen, even within the
same english title:

Hell-to-Pay Austin
The Co-respondent
A Pit-boy's Romance
A Cowboy's Mother-in-Law
Our Parents-In-Law
The Good-for-Nothing
When the Fire-Bells Rang
The post-millennial wave
...

[1] https://datasets.imdbws.com/


Best regards,
--
Daniel Vérité
https://postgresql.verite.pro/
Twitter: @DanielVerite



pgsql-general by date:

Previous
From: Loles
Date:
Subject: Re: Two started cluster on the same data directory and port
Next
From: John DeSoi
Date:
Subject: Re: libpq crashing on macOS during connection startup