Re: Fault with initcap

From: Shaozhong SHI <shishaozhong(at)gmail(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Fault with initcap
Date: 2021-10-12 23:03:07
Message-ID: CA+i5JwZ1K83K-TMsz7T=o2jQ+=2VcUKp-bh3VxH-j-HBjhSxpw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

On Tue, 12 Oct 2021 at 23:02, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
wrote:

> On 10/12/21 13:50, Shaozhong SHI wrote:
> >
> >
> > On Tue, 12 Oct 2021 at 20:34, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com
>
> >
> > Which follows the definition here:
> >
> > https://www.postgresql.org/docs/14/functions-string.html
> > <https://www.postgresql.org/docs/14/functions-string.html>
> >
> > initcap ( text ) → text
> >
> > Converts the first letter of each word to upper case and the rest to
> > lower case. Words are sequences of alphanumeric characters separated
> by
> > non-alphanumeric characters.
> >
> > Hi, Adrian Klaver,
> >
> >
> > It looks like that you replicated the error.
>
> There is no error, initcap is doing what it is documented to.
>
> notemachine is not two words anymore then 'online', 'bluebell',
> 'network' are.
>
>
> >
> > There must be a way to do the following.
>
> Maybe, but as Karsten says it would involve an AI. One that understands
> the mutt language that is English.
>
> >
> > a column contains a list of words. Only the first letter of each word
> > should be capitalised. INITCAP can not do that. How to create a
> > function just to capitalised each word (substring) in a list of
> > words/strings. This will be very useful and create great impact.
>
> From here:
>
> https://www.grammarly.com/blog/14-of-the-longest-words-in-english/
>
> uncopyrightable
>
> where would you split that into words?:
>
> Some 'words' I see:
>
> un
> unc
> copy
> copyright
> right
> table
> able
>
> >
> > Regards,
> >
> > David
>
>
> --
> Adrian Klaver
> adrian(dot)klaver(at)aklaver(dot)com

Hi, Adrian Klaver,

In Python, there is a capwords. Do we have an equivalent in Postgres?
Regards, David

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2021-10-13 00:27:51 Re: Fault with initcap
Previous Message Tomas Vondra 2021-10-12 22:07:11 Re: Avg/max size of these JSON docs in Postgres

Browse pgsql-sql by date

  From Date Subject
Next Message Steve Midgley 2021-10-13 00:17:26 Re: Removing JSONB key across all elements of nested array
Previous Message Adrian Klaver 2021-10-12 22:02:55 Re: Fault with initcap