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

Find number in a string

Former Member
0 Likes
562

Hi,

I want to find the offset of a 4 digit number between to () in a string.

For the given string:

a()(1)(1234)5678

I would like to recive the offset should return 8 (the offset of 1).

Any Ideas ?

Hi,

I want to find the offset of a 4 digit number between to () in a string.

For the given string:

a()(1)(1234)5678

I would like to recive the offset should return 8 (the offset of 1).

Any Ideas ?

3 REPLIES 3
Read only

RaymondGiuseppi
Active Contributor
0 Likes
536

Look at this sdn contribution which may help you [REGEX TOY: TESTING REGULAR EXPRESSIONS IN ABAP|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/1f9cd701-0b01-0010-87b8-f86f9b7b823f]

Regards

Read only

tarangini_katta
Active Contributor
0 Likes
536

Hi All,

I have asame problem as him. i have a string. like this .

B1;;2009/11 Claim: 007324;SA;20081006;20091101;I004;;1032000MAR;;

i want to find the I004 in that string.I can't hard code and find.Because it is from file.it does contain any value in that postion.

I wnat to find t through Find with Regular Expression.

Please help out.

Thanks,

Read only

0 Likes
536

Hi,

The following code might solve your problem.

Copy the content into temporary variable l_temp2.

after the Do loop l_required will have the required value.

DO.

SEARCH L_TEMP2 FOR ';'.

IF SY-SUBRC = 0.

SHIFT L_TEMP2 BY SY-FDPOS PLACES.

SHIFT L_TEMP2 LEFT.

IF SY-INDEX = 6.

L_REQUIRED = L_TEMP2(4).

EXIT.

ENDIF.

ELSE.

EXIT.

ENDIF.

ENDDO.