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 with char and Int

Former Member
0 Likes
429

hi,

i want to split a string with char and int, then string are concanating with '+'.

e.g. string = " text1 text2 text3 5"

result = text1text2text3

int = 5

How can i do it?

thx

shuo

hi,

i want to split a string with char and int, then string are concanating with '+'.

e.g. string = " text1 text2 text3 5"

result = text1text2text3

int = 5

How can i do it?

thx

shuo

2 REPLIES 2
Read only

Former Member
0 Likes
406

Shuo,

Please see the code below

DATA itab TYPE TABLE OF string WITH HEADER LINE.

DATA : str TYPE string VALUE 'text111 text222 tex333 4444',

opstr type string.

DATA : int TYPE i.

SPLIT str AT space INTO TABLE itab.

LOOP AT itab.

IF NOT ( itab CN '0123456789' ).

int = itab.

ELSE.

CONCATENATE opstr itab INTO opstr separated by space.

ENDIF.

ENDLOOP.

WRITE 😕 'String', opstr.

WRITE 😕 'Integer', int.

<i>Reward if you find it useful</i>

Regards,

Sail

Read only

0 Likes
406

Hi Sail,

thank you so much, it's very helpful.

regards

Shuo