dbTalk Databases Forums  

Replacing Strings

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss Replacing Strings in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #21  
Old   
Álvaro G. Vicario
 
Posts: n/a

Default Re: Replacing Strings - 09-12-2008 , 05:02 AM






Michel Cadot escribió:
Quote:
replace(column,'|',chr(10))
[...]
But what about the leading spaces? Those disappear if I use replace
or translate or even LPAD........

---------------------------------

It is not my experience.
Copy and paste what you did.
If it works for you, it's possible that the O.P. is outputting the
result into an HTML document where, as HTML dictates, leading spaces are
ignored.


--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor al baño María: http://www.demogracia.com
--


Reply With Quote
  #22  
Old   
exec@chicagorsvp.com
 
Posts: n/a

Default Re: Replacing Strings - 09-12-2008 , 01:40 PM






On Sep 11, 3:42*pm, sybra... (AT) hccnet (DOT) nl wrote:
Quote:
On Thu, 11 Sep 2008 12:01:25 -0700 (PDT), e... (AT) chicagorsvp (DOT) com wrote:
On Sep 11, 1:41*pm, "Michel Cadot" <micadot{at}altern{dot}org> wrote:
e... (AT) chicagorsvp (DOT) com> a écrit dans le message de news: adee164f-6729-416f-8eca-35556d30f... (AT) m45g2000hsb (DOT) googlegroups.com...
| Hi,
|
| We have some messages stored in a column in this format: *AA|BB|CC|DD
|
| What we want is to replace the vertical bars with a CHR(10) for line
| feed, but have 3 leading spaces.
|
| Everything I try seems to only indent the first item 3 characters.
| Even I try to replace it with ' * ' || CHR(10) and it ignores the
| spaces.......
|
| What we want is:
| * AA
| * BB
| * CC
|
| Ideas anyone?

replace(column,'|',chr(10))

Regards
Michel

But what about the leading spaces? *Those disappear if I use replace
or translate or even LPAD........

I suggest you check (and post the results and your exact code) by
prepending the string with an '*' or something like that.
You must be doing something wrong: either your code is wrong, or you
have a display problem.
Also you should also, in *every post* include your complete version
number.
We can not be bothered to memorize it.

--
Sybrand Bakker
Senior Oracle DBA- Hide quoted text -

- Show quoted text -
Sorry Sybrand.

I wound up writing some loop to parse on the delimiter......only 5
lines, but I could not find a way to take a string like this:

AA|BB|CC

and put it into this: Notice the leading spaces:

AA
BB
CC

So, I wrote the loop thingy. I used this to find the number of
delimiters:

SELECT LENGTH(v_rec.messages) -
LENGTH(REPLACE(v_rec.messages,'|',NULL)) INTO v_num_messages FROM
dual;

Sort of cryptic, but I think I understand it. Taking the length of
the string, and subtracting the length of the string not including the
delimiters.



Reply With Quote
  #23  
Old   
exec@chicagorsvp.com
 
Posts: n/a

Default Re: Replacing Strings - 09-12-2008 , 01:40 PM



On Sep 11, 3:42*pm, sybra... (AT) hccnet (DOT) nl wrote:
Quote:
On Thu, 11 Sep 2008 12:01:25 -0700 (PDT), e... (AT) chicagorsvp (DOT) com wrote:
On Sep 11, 1:41*pm, "Michel Cadot" <micadot{at}altern{dot}org> wrote:
e... (AT) chicagorsvp (DOT) com> a écrit dans le message de news: adee164f-6729-416f-8eca-35556d30f... (AT) m45g2000hsb (DOT) googlegroups.com...
| Hi,
|
| We have some messages stored in a column in this format: *AA|BB|CC|DD
|
| What we want is to replace the vertical bars with a CHR(10) for line
| feed, but have 3 leading spaces.
|
| Everything I try seems to only indent the first item 3 characters.
| Even I try to replace it with ' * ' || CHR(10) and it ignores the
| spaces.......
|
| What we want is:
| * AA
| * BB
| * CC
|
| Ideas anyone?

replace(column,'|',chr(10))

Regards
Michel

But what about the leading spaces? *Those disappear if I use replace
or translate or even LPAD........

I suggest you check (and post the results and your exact code) by
prepending the string with an '*' or something like that.
You must be doing something wrong: either your code is wrong, or you
have a display problem.
Also you should also, in *every post* include your complete version
number.
We can not be bothered to memorize it.

--
Sybrand Bakker
Senior Oracle DBA- Hide quoted text -

- Show quoted text -
Sorry Sybrand.

I wound up writing some loop to parse on the delimiter......only 5
lines, but I could not find a way to take a string like this:

AA|BB|CC

and put it into this: Notice the leading spaces:

AA
BB
CC

So, I wrote the loop thingy. I used this to find the number of
delimiters:

SELECT LENGTH(v_rec.messages) -
LENGTH(REPLACE(v_rec.messages,'|',NULL)) INTO v_num_messages FROM
dual;

Sort of cryptic, but I think I understand it. Taking the length of
the string, and subtracting the length of the string not including the
delimiters.



Reply With Quote
  #24  
Old   
exec@chicagorsvp.com
 
Posts: n/a

Default Re: Replacing Strings - 09-12-2008 , 01:40 PM



On Sep 11, 3:42*pm, sybra... (AT) hccnet (DOT) nl wrote:
Quote:
On Thu, 11 Sep 2008 12:01:25 -0700 (PDT), e... (AT) chicagorsvp (DOT) com wrote:
On Sep 11, 1:41*pm, "Michel Cadot" <micadot{at}altern{dot}org> wrote:
e... (AT) chicagorsvp (DOT) com> a écrit dans le message de news: adee164f-6729-416f-8eca-35556d30f... (AT) m45g2000hsb (DOT) googlegroups.com...
| Hi,
|
| We have some messages stored in a column in this format: *AA|BB|CC|DD
|
| What we want is to replace the vertical bars with a CHR(10) for line
| feed, but have 3 leading spaces.
|
| Everything I try seems to only indent the first item 3 characters.
| Even I try to replace it with ' * ' || CHR(10) and it ignores the
| spaces.......
|
| What we want is:
| * AA
| * BB
| * CC
|
| Ideas anyone?

replace(column,'|',chr(10))

Regards
Michel

But what about the leading spaces? *Those disappear if I use replace
or translate or even LPAD........

I suggest you check (and post the results and your exact code) by
prepending the string with an '*' or something like that.
You must be doing something wrong: either your code is wrong, or you
have a display problem.
Also you should also, in *every post* include your complete version
number.
We can not be bothered to memorize it.

--
Sybrand Bakker
Senior Oracle DBA- Hide quoted text -

- Show quoted text -
Sorry Sybrand.

I wound up writing some loop to parse on the delimiter......only 5
lines, but I could not find a way to take a string like this:

AA|BB|CC

and put it into this: Notice the leading spaces:

AA
BB
CC

So, I wrote the loop thingy. I used this to find the number of
delimiters:

SELECT LENGTH(v_rec.messages) -
LENGTH(REPLACE(v_rec.messages,'|',NULL)) INTO v_num_messages FROM
dual;

Sort of cryptic, but I think I understand it. Taking the length of
the string, and subtracting the length of the string not including the
delimiters.



Reply With Quote
  #25  
Old   
exec@chicagorsvp.com
 
Posts: n/a

Default Re: Replacing Strings - 09-12-2008 , 01:40 PM



On Sep 11, 3:42*pm, sybra... (AT) hccnet (DOT) nl wrote:
Quote:
On Thu, 11 Sep 2008 12:01:25 -0700 (PDT), e... (AT) chicagorsvp (DOT) com wrote:
On Sep 11, 1:41*pm, "Michel Cadot" <micadot{at}altern{dot}org> wrote:
e... (AT) chicagorsvp (DOT) com> a écrit dans le message de news: adee164f-6729-416f-8eca-35556d30f... (AT) m45g2000hsb (DOT) googlegroups.com...
| Hi,
|
| We have some messages stored in a column in this format: *AA|BB|CC|DD
|
| What we want is to replace the vertical bars with a CHR(10) for line
| feed, but have 3 leading spaces.
|
| Everything I try seems to only indent the first item 3 characters.
| Even I try to replace it with ' * ' || CHR(10) and it ignores the
| spaces.......
|
| What we want is:
| * AA
| * BB
| * CC
|
| Ideas anyone?

replace(column,'|',chr(10))

Regards
Michel

But what about the leading spaces? *Those disappear if I use replace
or translate or even LPAD........

I suggest you check (and post the results and your exact code) by
prepending the string with an '*' or something like that.
You must be doing something wrong: either your code is wrong, or you
have a display problem.
Also you should also, in *every post* include your complete version
number.
We can not be bothered to memorize it.

--
Sybrand Bakker
Senior Oracle DBA- Hide quoted text -

- Show quoted text -
Sorry Sybrand.

I wound up writing some loop to parse on the delimiter......only 5
lines, but I could not find a way to take a string like this:

AA|BB|CC

and put it into this: Notice the leading spaces:

AA
BB
CC

So, I wrote the loop thingy. I used this to find the number of
delimiters:

SELECT LENGTH(v_rec.messages) -
LENGTH(REPLACE(v_rec.messages,'|',NULL)) INTO v_num_messages FROM
dual;

Sort of cryptic, but I think I understand it. Taking the length of
the string, and subtracting the length of the string not including the
delimiters.



Reply With Quote
  #26  
Old   
sybrandb@hccnet.nl
 
Posts: n/a

Default Re: Replacing Strings - 09-12-2008 , 02:06 PM



On Fri, 12 Sep 2008 11:40:22 -0700 (PDT), exec (AT) chicagorsvp (DOT) com wrote:

Quote:
Sorry Sybrand.

I wound up writing some loop to parse on the delimiter......only 5
lines, but I could not find a way to take a string like this:
I'm not sure why you didn't follow up valid advice from me and others,
and didn't respond to our questions, but decided to hack yourself out.
Something to keep in mind with your next question, when you might
again 'know better' than the people trying to help you out.

--
Sybrand Bakker
Senior Oracle DBA


Reply With Quote
  #27  
Old   
sybrandb@hccnet.nl
 
Posts: n/a

Default Re: Replacing Strings - 09-12-2008 , 02:06 PM



On Fri, 12 Sep 2008 11:40:22 -0700 (PDT), exec (AT) chicagorsvp (DOT) com wrote:

Quote:
Sorry Sybrand.

I wound up writing some loop to parse on the delimiter......only 5
lines, but I could not find a way to take a string like this:
I'm not sure why you didn't follow up valid advice from me and others,
and didn't respond to our questions, but decided to hack yourself out.
Something to keep in mind with your next question, when you might
again 'know better' than the people trying to help you out.

--
Sybrand Bakker
Senior Oracle DBA


Reply With Quote
  #28  
Old   
sybrandb@hccnet.nl
 
Posts: n/a

Default Re: Replacing Strings - 09-12-2008 , 02:06 PM



On Fri, 12 Sep 2008 11:40:22 -0700 (PDT), exec (AT) chicagorsvp (DOT) com wrote:

Quote:
Sorry Sybrand.

I wound up writing some loop to parse on the delimiter......only 5
lines, but I could not find a way to take a string like this:
I'm not sure why you didn't follow up valid advice from me and others,
and didn't respond to our questions, but decided to hack yourself out.
Something to keep in mind with your next question, when you might
again 'know better' than the people trying to help you out.

--
Sybrand Bakker
Senior Oracle DBA


Reply With Quote
  #29  
Old   
sybrandb@hccnet.nl
 
Posts: n/a

Default Re: Replacing Strings - 09-12-2008 , 02:06 PM



On Fri, 12 Sep 2008 11:40:22 -0700 (PDT), exec (AT) chicagorsvp (DOT) com wrote:

Quote:
Sorry Sybrand.

I wound up writing some loop to parse on the delimiter......only 5
lines, but I could not find a way to take a string like this:
I'm not sure why you didn't follow up valid advice from me and others,
and didn't respond to our questions, but decided to hack yourself out.
Something to keep in mind with your next question, when you might
again 'know better' than the people trying to help you out.

--
Sybrand Bakker
Senior Oracle DBA


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.