Re: Fault with initcap

Поиск
Список
Период
Сортировка
От Lee Hachadoorian
Тема Re: Fault with initcap
Дата
Msg-id CANnCtnKG20FtTKWjwr_nbNM9B6nZwxTyiqPVX_xBpd2fO71ThQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Fault with initcap  (Adrian Klaver <adrian.klaver@aklaver.com>)
Список pgsql-general


On Tue, Oct 12, 2021 at 8:28 PM Adrian Klaver <adrian.klaver@aklaver.com> wrote:

There is no function that just 'knows' that 'notemachine' is two words
and should become 'NoteMachine'.

Any chance that 'notemachine' is stored with a zero-width space (Unicode U+200B)? This is common for compound words where the programmer wants to be able to "know" that they are distinct words that are smashed together.

select initcap('notemachine'), initcap('note' || U&'\200B' || 'machine');

initcap    |initcap     |
-----------+------------+
Notemachine|NoteMachine|

You could check the length() of the string. If it is 12, there is an invisible character in there. This would explain the "unexpected" behavior that no one seems to be able to replicate.

Best,
--Lee

--
Lee Hachadoorian
Assistant Professor of Instruction, Geography and Urban Studies
Assistant Director, Professional Science Master's in GIS
Temple University

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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Fault with initcap
Следующее
От: Simon Riggs
Дата:
Сообщение: Re: Avg/max size of these JSON docs in Postgres