Application Development 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: 

String Functions

Former Member
0 Kudos

Hi,

I have a string that contain/s &text&, text can be anything.

I want to extract all such text in the string.

How can i achieve this, please help

Regards,

piyush

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello,

Example

: Search for all occurrences of the string "now" in a string literal. The offsets 11 and 24 of both found locations are displayed as output.

DATA: patt TYPE string VALUE `now`,

text TYPE string,

result_tab TYPE match_result_tab.

FIELD-SYMBOLS <match> LIKE LINE OF result_tab.

FIND ALL OCCURRENCES OF patt IN

`Everybody knows this is nowhere`

RESULTS result_tab.

LOOP AT result_tab ASSIGNING <match>.

WRITE: / <match>-offset, <match>-length.

ENDLOOP.

Regards.

1 REPLY 1

Former Member
0 Kudos

Hello,

Example

: Search for all occurrences of the string "now" in a string literal. The offsets 11 and 24 of both found locations are displayed as output.

DATA: patt TYPE string VALUE `now`,

text TYPE string,

result_tab TYPE match_result_tab.

FIELD-SYMBOLS <match> LIKE LINE OF result_tab.

FIND ALL OCCURRENCES OF patt IN

`Everybody knows this is nowhere`

RESULTS result_tab.

LOOP AT result_tab ASSIGNING <match>.

WRITE: / <match>-offset, <match>-length.

ENDLOOP.

Regards.