Re: Fault with initcap

2021-10-12 Thread Lee Hachadoorian
On Tue, Oct 12, 2021 at 8:28 PM Adrian Klaver 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 progr

Re: Fault with initcap

2021-10-12 Thread Adrian Klaver
On 10/12/21 16:03, Shaozhong SHI wrote: Hi, Adrian Klaver, In Python, there is  a capwords.  Do we have an equivalent in Postgres? https://docs.python.org/3/library/string.html?highlight=capwords#string.capwords string.capwords(s, sep=None) Split the argument into words using str.

Re: Fault with initcap

2021-10-12 Thread Shaozhong SHI
On Tue, 12 Oct 2021 at 23:02, Adrian Klaver wrote: > On 10/12/21 13:50, Shaozhong SHI wrote: > > > > > > On Tue, 12 Oct 2021 at 20:34, Adrian Klaver > > > > Which follows the definition here: > > > > https://www.postgresql.org/docs/14/functions-string.html > >

Re: Fault with initcap

2021-10-12 Thread Adrian Klaver
On 10/12/21 13:50, Shaozhong SHI wrote: On Tue, 12 Oct 2021 at 20:34, Adrian Klaver Which follows the definition here: https://www.postgresql.org/docs/14/functions-string.html initcap ( text ) → text Converts

Re: Fault with initcap

2021-10-12 Thread Karsten Hilbert
Am Tue, Oct 12, 2021 at 09:50:16PM +0100 schrieb Shaozhong SHI: > There must be a way to do the following. > > [...] Only the first letter of each word should be capitalised. Indeed, there is. It is called "human brain in cultural context". "AI" is close nowadays, but, hopefully, not quite there

Re: Fault with initcap

2021-10-12 Thread Shaozhong SHI
On Tue, 12 Oct 2021 at 20:34, Adrian Klaver 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'); >

Aw: Re: Re: Fault with initcap

2021-10-12 Thread Karsten Hilbert
> Only the first letter of each word to be capitalised/uppercased. The next step is to not top-post. Then to keep the list involved if you wish further help. Then, if you are intent on using regular expressions, look at the PostgreSQL docs for regexp_replace. Karsten  

Re: Fault with initcap

2021-10-12 Thread Adrian Klaver
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 Sains

Aw: Re: Fault with initcap

2021-10-12 Thread Karsten Hilbert
Hi David, >Expected are as follows: >Notemachine >Sainsbury's bank. Now, step two: generalize that exemplary definition. Karsten

Fault with initcap

2021-10-12 Thread Shaozhong SHI
I tried initcap and found a major problem with it. Initcap of notemachine is NoteMachine. Initcap of Sainsbury's Bank is Sainsbury'S bank. This is not expected. Anyway to get around this problem? Regards, David