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 Relational Operators

Former Member
0 Likes
918

Hi,

I have one string as 'ABCD#XYZ'

I want to find out the index of # from this string.

How can i do that.

Please help me.

Regards,

Deepak.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
880

Keyword FIND/Search?

SY-FDPOS??

data : var(10) TYPE c VALUE 'ABCD#XYZ'.

SEARCH var for '#'.

if sy-subrc = 0.

WRITE 😕 sy-fdpos.

endif.

Edited by: Milind Mungaji on Sep 23, 2008 1:28 PM

6 REPLIES 6
Read only

Former Member
0 Likes
881

Keyword FIND/Search?

SY-FDPOS??

Read only

Former Member
0 Likes
880

Hi,

SEARCH STRING FOR '#'.

WRITE: SY-FDPOS

Regards,

Surinder

Read only

MilindMungaji
Participant
0 Likes
880

data : var(10) TYPE c VALUE 'ABCD#XYZ'.

SEARCH var for '#'.

if sy-subrc = 0.

WRITE 😕 sy-fdpos.

endif.

Edited by: Milind Mungaji on Sep 23, 2008 1:28 PM

Read only

Former Member
0 Likes
880

Hi,

Please use below code

data:fff type string value 'AB#CDXYZ'.

if fff ca '#'.

write: / sy-fdpos .

endif.

it count starts with ZERO position

Regards

jana

Read only

Former Member
0 Likes
880

Hi,

Try like this.....


data : var3(10) TYPE c VALUE 'ABCD#XYZ'.
SEARCH var3 for '#'.
if sy-subrc = 0.
WRITE :/ sy-fdpos.
endif.

OR


Data : var3(15) type c.
Data : len type i.
var3 = 'ABC#GOEFGH'.
FIND '#' IN var3 match offset len.
write : / len.

Hope it will helps

Read only

Former Member
0 Likes
880

Search forum,

Link: