cancel
Showing results for 
Search instead for 
Did you mean: 

STANDARD MAPPING FUNCTION

former_member614185
Contributor
0 Kudos

Hi experts,

Can u please explain the following standard Text functions with some examples,

Indexof (2 input parameter)

Indexof(3 input parameter)

Lastindex of(2 input parameter)

Lastindexof(3 input parameter)

I gone thru the sap help link and worked with simple example. but still i have some doubt with 2&3 parameters and Lastindexof and indexof.

also suggest me at which time we can use these functions.

Thanks in advance

Accepted Solutions (1)

Accepted Solutions (1)

santhosh_kumarv
Active Contributor
0 Kudos

>>Indexof (2 input parameter)

Returns the positon where the second string is found in the first string.

Eg: santhosh & a = 1.

santhosh & s = 0.

>>Indexof(3 input parameter)

Returns the positon where the second string is found in the first string but the search starts from the specified position.

Eg: santhosh & s & 0 = 0 but

santhosh & s & 3 = 6 bcz after the 3rd pos s occurs at 6th pos.

>>Lastindex of(2 input parameter)

Eg: santhosh & s = 6.

>>Lastindexof(3 input parameter)

santhosh & s & 3 = 6

Lastindex is same as index except it searches for the last occurance

Regards

San

there is a Way.

Message was edited by:

Santhosh Kumar V

Answers (1)

Answers (1)

Former Member

Hi,

IndexOf (2) will search for the string specified in second parameter in the string specified in first parameter and returns the index of the first occurence.

IndexOf (3) it works in the sameway as above but will not start searching from the beginning and will search from the index specified in the parameter. If you specify zero in the parameter literally there is no difference in both of them as both search from the beginning.

lastIndexOf also works in the same way as explained above except that it returns the last occurence instead of first.

Hope i am clear.

Regards,

Sudheer.