Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

String Modifications

Former Member
0 Likes
641

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

6 REPLIES 6
Read only

Former Member
0 Likes
617

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 '-'.

Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
617

Hi,

DATA: str type string.

data:ch(10) value '0123456789'.

concatenate ch0(5) '_' ch5(5) into str.

Regards,

Sesh

Read only

Former Member
0 Likes
617

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

Read only

Former Member
0 Likes
617

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.

Read only

Former Member
0 Likes
617

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

Read only

Former Member
0 Likes
617

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