2008 Feb 04 2:35 PM
Dear All.
I have a string of around 60-80 characters and its length depends at run time. Now I would like to insert a character value between the 3rd and the 4th character of the string.
E.g : Str1 = '020BUPATEXAS...'
Now I would like to insert a value 'E' between a 3rd charactre and 4th character as below:
Str1 = '020EBUPATEXAS....'
Can anyone throw some light on this.
Regards, Vinay
2008 Feb 04 2:42 PM
Hi,
You need a new variable, and then fill this piece by piece.
move: str1(3) to new_text(3),
'E' to new_text+3(1),
str1+3 to new_text+4.
Regards,
Nick
2008 Feb 04 2:47 PM
Hi,
Try this
REPORT ZTEST_CHA.
data : V_char type string,
v_len type i.
v_char = '020string'.
V_len = strlen( v_char ).
v_len = v_len - 3.
concatenate v_char+0(3) 'E' v_char+3(v_len) into v_char.
write : v_char.
2008 Feb 04 3:05 PM
Hi,
Another solution witout new variable:
DATA:
str1 TYPE string
VALUE '020BUPATEXASxxxxxxx'.
CONCATENATE str1(3) 'E' str1+3 INTO str1.
Regards,
Daniel
2019 Dec 12 9:23 AM
2019 Dec 12 9:27 AM
priyahydee77
the new statement propose now
result = str1+0(3) && 'E' && str1+3.
or better
result = |{ str1+0(3)} E {str1+3}|