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

Strings

Former Member
0 Likes
770

Hi ,

Anyone please tell me the syntax.How can I take a string and remove its last 6 characters and put it into another variable?

Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
747

Hi

Data: v_string type string,

v_new_string type string,

v_len type i,

v_len1 type i.

v_string = '0123456789'.

  • Get full length

v_len = STRLEN( V_STRING ).

  • get the offset

V_len1 = v_len - 6.

  • Move the last 6 characters to another string

V_NEW_STRING = v_string+v_len1(6).

Hope this solves your problem.

Regards

Kathirvel

6 REPLIES 6
Read only

Former Member
0 Likes
748

Hi

Data: v_string type string,

v_new_string type string,

v_len type i,

v_len1 type i.

v_string = '0123456789'.

  • Get full length

v_len = STRLEN( V_STRING ).

  • get the offset

V_len1 = v_len - 6.

  • Move the last 6 characters to another string

V_NEW_STRING = v_string+v_len1(6).

Hope this solves your problem.

Regards

Kathirvel

Read only

0 Likes
747

V_NEW_STRING = v_string+v_len1(6).

It show some error at this line

Read only

Former Member
0 Likes
747

Please try this in that part

data: v_char(100) type c.

v_char = v_string.

v_new_string = v_char+v_len1(6).

Regards

Kathirvel

Read only

Former Member
0 Likes
747

Hi,

The above works fine for me..

Thanks,

Naren

Read only

Former Member
0 Likes
747

Try to check the declaration again, it should work fine.

Regards

Kathirvel

Read only

ferry_lianto
Active Contributor
0 Likes
747

Hi Sri,

Please check this FM C147_STRING_SHIFT.

Regards,

Ferry Lianto