2007 Jun 22 6:46 AM
Hi
I want to replace hyper with space. Is the below sytax correct. I am not getting space.
REPLACE ALL OCCURRENCES OF '-' IN str WITH SPACE
input : abc-xyz output : abcxyz
I want a space between abc and xyz.
thanks
balaji
2007 Jun 22 7:35 AM
Hi Balaji,
This will solve your problem.
data: str(20) type c.
str = 'hari,krishna,rao'.
TRANSLATE STR <b>USING ', '.</b>
write str.
Keep in mind that in <u>USING after comma....there is a SPACE.</u>
Reward points if it is answered.
Thanks.
Hari krishna
Hi
I want to replace hyper with space. Is the below sytax correct. I am not getting space.
REPLACE ALL OCCURRENCES OF '-' IN str WITH SPACE
input : abc-xyz output : abcxyz
I want a space between abc and xyz.
thanks
balaji
2007 Jun 22 6:50 AM
Balaji,
REPLACE <str1> WITH <str2> INTO <c> [LENGTH <l>].
DATA: T(10) VALUE 'abcdefghij',
STRING LIKE T,
STR1(4) VALUE 'cdef',
STR2(4) VALUE 'klmn',
STR3(2) VALUE 'kl',
STR4(6) VALUE 'klmnop',
LEN TYPE I VALUE 2.
STRING = T.
WRITE STRING.
REPLACE STR1 WITH STR2 INTO STRING.
WRITE / STRING.
Don't forget to reward if useful...
2007 Jun 22 6:53 AM
Hi,
I think replace will not wrk in ur case as u need to insert a space in place of hyphen.
What u can do is use the following piece of code:
DATA : str TYPE string,
a type string,
b type string.
str = 'abc-xyz'.
WRITE : str.
SPLIT str AT '-' INTO a b.
CONCATENATE a b INTO str SEPARATED BY space.
WRITE : / str.
Regards,
Himanshu
2007 Jun 22 6:55 AM
Balaji,
data: v1(1) type c value '-'.
replace '-' in v1 with ' '.
write:/ 'v1:-',v1.
K.Kiran.
Message was edited by:
Kiran K
2007 Jun 22 7:35 AM
Hi Balaji,
This will solve your problem.
data: str(20) type c.
str = 'hari,krishna,rao'.
TRANSLATE STR <b>USING ', '.</b>
write str.
Keep in mind that in <u>USING after comma....there is a SPACE.</u>
Reward points if it is answered.
Thanks.
Hari krishna
2007 Jun 22 7:41 AM
Hi,
As suggested,translate will help.
data: str(20) type c.
str = 'abc-xyz'.
TRANSLATE STR USING '- '.
write str.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |