pg.ddx.io pgsql-php@postgresql.org mailing list archive
help / color / mirror / Atom feedRe: underscore
4+ messages / 4 participants
[nested] [flat]
* Re: underscore
@ 2003-01-30 05:09 ryanne cruz <ryanne.cruz@up.edu.ph>
2003-01-30 05:10 ` Re: underscore Matthew Horoschun <mhoroschun@canprint.com.au>
2003-01-30 16:11 ` Re: underscore Steve Crawford <scrawford@pinpointresearch.com>
0 siblings, 2 replies; 4+ messages in thread
From: ryanne cruz @ 2003-01-30 05:09 UTC (permalink / raw)
To: pgsql-php
hi list!
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?
thanks!
ryanne
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: underscore
2003-01-30 05:09 Re: underscore ryanne cruz <ryanne.cruz@up.edu.ph>
@ 2003-01-30 05:10 ` Matthew Horoschun <mhoroschun@canprint.com.au>
2003-01-30 19:33 ` Re: underscore scott.marlowe <scott.marlowe@ihs.com>
1 sibling, 1 reply; 4+ messages in thread
From: Matthew Horoschun @ 2003-01-30 05:10 UTC (permalink / raw)
To: ryanne cruz <ryanne.cruz@up.edu.ph>; +Cc: pgsql-php
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, ' ', '_' );
Matthew.
--
Matthew Horoschun
Network Administrator
CanPrint Communications Pty. Ltd.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: underscore
2003-01-30 05:09 Re: underscore ryanne cruz <ryanne.cruz@up.edu.ph>
2003-01-30 05:10 ` Re: underscore Matthew Horoschun <mhoroschun@canprint.com.au>
@ 2003-01-30 19:33 ` scott.marlowe <scott.marlowe@ihs.com>
0 siblings, 0 replies; 4+ messages in thread
From: scott.marlowe @ 2003-01-30 19:33 UTC (permalink / raw)
To: Matthew Horoschun <mhoroschun@canprint.com.au>; +Cc: ryanne cruz <ryanne.cruz@up.edu.ph>; pgsql-php
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.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: underscore
2003-01-30 05:09 Re: underscore ryanne cruz <ryanne.cruz@up.edu.ph>
@ 2003-01-30 16:11 ` Steve Crawford <scrawford@pinpointresearch.com>
1 sibling, 0 replies; 4+ messages in thread
From: Steve Crawford @ 2003-01-30 16:11 UTC (permalink / raw)
To: ryanne cruz <ryanne.cruz@up.edu.ph>; pgsql-php
try translate():
select translate('Mary Margaret Smith',' ','_');
translate
---------------------
Mary_Margaret_Smith
Cheers,
Steve
On Wednesday 29 January 2003 9:09 pm, ryanne cruz wrote:
> hi list!
>
> 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?
>
> thanks!
>
> ryanne
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2003-01-30 19:33 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-01-30 05:09 Re: underscore ryanne cruz <ryanne.cruz@up.edu.ph>
2003-01-30 05:10 ` Matthew Horoschun <mhoroschun@canprint.com.au>
2003-01-30 19:33 ` scott.marlowe <scott.marlowe@ihs.com>
2003-01-30 16:11 ` Steve Crawford <scrawford@pinpointresearch.com>
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