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 manipulation

Former Member
0 Likes
463

hello,

please help me. my variable contains this text 'CA_Product', how would i get the 'CA' only. in general how would i get the letter before the underline (_). thanks.

1 ACCEPTED SOLUTION
Read only

vinotha_m
Participant
0 Likes
446

Hey Donna,

Split the string using the charachter' _ ' and then u will get it into another variable.

data : DELIMITER(2) VALUE '_'.

text1 = 'CA_Product'.

SPLIT text1 AT DELIMITER INTO text2 text3.

3 REPLIES 3
Read only

vinotha_m
Participant
0 Likes
447

Hey Donna,

Split the string using the charachter' _ ' and then u will get it into another variable.

data : DELIMITER(2) VALUE '_'.

text1 = 'CA_Product'.

SPLIT text1 AT DELIMITER INTO text2 text3.

Read only

0 Likes
446

Thank u,

Donna

Read only

Former Member
0 Likes
446
DATA: t3(14) TYPE c VALUE 'CA_product',
      string3 LIKE t3,
      str3(1) TYPE c VALUE '_',
     int TYPE i.
string3 = t3.
WRITE string3.

SHIFT string3 RIGHT DELETING TRAILING str3.
WRITE / string3.
SHIFT string3 LEFT DELETING LEADING space.
SKIP.
ULINE.
int = strlen( sting3 ).

Then now u can read string3 using OFFSET+0(int).