From: Daniel Verite <daniel@manitou-mail.org>
To: Jeff Gerbracht <jeffgerbracht@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Feature request for INITCAP() function
Date: Fri, 01 Dec 2023 12:52:01 +0100
Message-ID: <c7ecbe59-9a76-4e54-ae85-b0dd95c19cab@manitou-mail.org> (raw)
In-Reply-To: <CAEwbS1R8pwhRkwRo3XsPt24ErBNtFWuReAZhVPJwA3oqo148tA@mail.gmail.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: daniel@manitou-mail.org, jeffgerbracht@gmail.com
Subject: Re: Feature request for INITCAP() function
In-Reply-To: <c7ecbe59-9a76-4e54-ae85-b0dd95c19cab@manitou-mail.org>
References: <CAEwbS1R8pwhRkwRo3XsPt24ErBNtFWuReAZhVPJwA3oqo148tA@mail.gmail.com> <c7ecbe59-9a76-4e54-ae85-b0dd95c19cab@manitou-mail.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox