Re: Fault with initcap

Поиск
Список
Период
Сортировка
От Shaozhong SHI
Тема Re: Fault with initcap
Дата
Msg-id CA+i5JwYOMPrzNgX0eu6w+NFTObKf9NCiE3BKK2bS3nNd_=FfdA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Fault with initcap  (Adrian Klaver <adrian.klaver@aklaver.com>)
Ответы Re: Fault with initcap  (Karsten Hilbert <Karsten.Hilbert@gmx.net>)
Re: Fault with initcap  (Adrian Klaver <adrian.klaver@aklaver.com>)
Список pgsql-general


On Tue, 12 Oct 2021 at 20:34, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 10/12/21 09:31, Shaozhong SHI wrote:
> I tried initcap and found a major problem with it.

What Postgres version?

In version 12 and 14 I get:

>
> Initcap of notemachine is NoteMachine.

select initcap('notemachine');
    initcap
-------------
  Notemachine

>
> Initcap of Sainsbury's Bank is Sainsbury'S bank.

select initcap('Sainsbury''s Bank');
      initcap
------------------
  Sainsbury'S Bank


Which follows the definition here:

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 must be a way to do the following.

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.

Regards,

David 

В списке pgsql-general по дате отправления:

Предыдущее
От: Karsten Hilbert
Дата:
Сообщение: Aw: Re: Re: Fault with initcap
Следующее
От: Karsten Hilbert
Дата:
Сообщение: Re: Fault with initcap