Re: Didn't correct output for LTRIM function

From: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
To: nikunjkvadsakabcd(at)gmail(dot)com, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: Didn't correct output for LTRIM function
Date: 2022-06-13 08:26:53
Message-ID: CAECtzeXyGMHamdC41ZrZ1oMfgyNpRKABpvWJupr7eGJ=CT2ekA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

Le lun. 13 juin 2022 à 10:06, PG Doc comments form <noreply(at)postgresql(dot)org>
a écrit :

> The following documentation comment has been logged on the website:
>
> Page: https://www.postgresql.org/docs/14/bug-reporting.html
> Description:
>
> First check the output of "select LTRIM(' startech academy ', ' sta');"
>
> output is "rtech academy "
> now the thing is output of "select LTRIM(' startech academy ', '
> star');"
> output is "ech academy "
> the question is where is 't'?
>
>
It's trimmed, because you asked t to be removed. It trims every single
character at the beginning of the string till it encounters another
character. The doc example makes it more clear:

ltrim('zzzytest', 'xyz') → test

https://www.postgresql.org/docs/14/functions-string.html

The problem is when we do LTRIM for trimming the first four characters, it
> trims the first five characters. but in the case of doing three characters,
> it gives the correct output.
>

Both outputs are correct actually.

--
Guillaume.

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message nikunj vadsak 2022-06-13 12:22:29 Re: Didn't correct output for LTRIM function
Previous Message PG Doc comments form 2022-06-13 01:46:18 Didn't correct output for LTRIM function