From: scott.marlowe <scott.marlowe@ihs.com>
To: Matthew Horoschun <mhoroschun@canprint.com.au>
Cc: ryanne cruz <ryanne.cruz@up.edu.ph>
Cc: \\\"pgsql-php@postgresql.org\\\" <pgsql-php@postgresql.org>
Subject: Re: underscore
Date: Thu, 30 Jan 2003 12:33:29 -0700 (MST)
Message-ID: <Pine.LNX.4.33.0301301233130.22730-100000@css120.ihs.com> (raw)
In-Reply-To: <1E50BE38-3411-11D7-9306-000393B3A702@canprint.com.au>
On Thu, 30 Jan 2003, Matthew Horoschun wrote:
> Hi Ryanne,
>
> On Thursday, January 30, 2003, at 04:09 PM, ryanne cruz wrote:
>
> > i have a column wherein a lot of entries has 2 or more names int it.
> > these are
> > separated by spaces. an example is: "John Doe", "Mary Margaret Smith".
> > i need
> > to replace the spaces with an underscore. any idea how to do this?
>
>
> In PHP use preg_replace (http://php.net/preg_replace for details)
>
> In PostgreSQL use replace(string text, from text, to text)
>
> (http://www.postgresql.org/docs/
> view.php?version=7.3&idoc=1&file=functions-string.html)
>
> To update a column in a table, you could do something like:
>
> UPDATE table SET column = REPLACE( column, ' ', '_' );
For something like this str_replace is easier to use and generally faster.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: scott.marlowe@ihs.com, mhoroschun@canprint.com.au, ryanne.cruz@up.edu.ph
Subject: Re: underscore
In-Reply-To: <Pine.LNX.4.33.0301301233130.22730-100000@css120.ihs.com>
References: <1E50BE38-3411-11D7-9306-000393B3A702@canprint.com.au> <Pine.LNX.4.33.0301301233130.22730-100000@css120.ihs.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox