07-03-2007 12:55 PM
I a storing a value of size 10 in a char variable.
But i need to insert thr "_" in the middle of that valuewhile display.
EX:
data:ch(10) value '0123456789'.
Now my requirement is when display this
It as to display as
01234_56789.
Plz Tell me any one how to do this
Thanks & Regards
Vamsin
07-03-2007 12:58 PM
first use FM STRING_SPLIT_AT_POSITION , with inputs as the string and the position
then you get the data in 2 variables , then concatenate them
concatenate string1 string2 into v_string separated by '-'.
07-03-2007 12:58 PM
Hi,
DATA: str type string.
data:ch(10) value '0123456789'.
concatenate ch0(5) '_' ch5(5) into str.
Regards,
Sesh
07-03-2007 12:58 PM
Hi Vamsi,
Check this code.
DATA CH(10) VALUE '0123456789'.
DATA V_CH(11).
<b>CONCATENATE CH0(5) CH5(5) INTO V_CH SEPARATED BY '_'.</b>
WRITE:/ V_CH.
Thanks,
Vinay
07-03-2007 12:59 PM
Take another character field of size 11
data:
ch1(11) type c.
move ch0(5) to ch10(5).
concatenate ch1 '_' into ch1.
move ch5(5) to ch16(5).
regards,
Pavan P.
07-03-2007 1:00 PM
Hi,
use code as below :
data: ch(10) value '0123456789'.
data : ch1(11).
data : part1(5), part2(5).
part1 = ch+0(5).
part2 = ch+5(5).
concatenate part1 '_' part2 into ch1.
write : / ch.
write : / ch1.
Reward points, if helpful,
Sandeep Kaushik
07-03-2007 1:05 PM
Hi,
You can do this by using another variable of type C of length 11.
Here you can d the follwoing:
DATA: Char2(11) type c.
Char20(5) = ch0(5).
Char2+5(1) = '_'.
Char26(5) = ch5(5).
Now display the variable Char2.
Ashvender