Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Processing Internal Data →  Character String and Byte String Processing →  Expressions and Functions for String Processing →  String Functions →  Description Functions for Character-Like Arguments 

char_off - Length Function

This length function has a named character-like argument.

Other versions: 7.31 | 7.40 | 7.54

Syntax


... char_off( val = text add = pos [off = off] ) ...

Effect

The function returns the offset of the character in text that is pos places away from the character in the offset specified in off. The default value for off is 0. text is a character-like expression position. pos and off are numeric expression positions with the type i.

This function can be specified in general and numeric expression positions. The return value has the type i.

The value of pos can be positive and negative and has the appropriate number of places on the right or on the left. If pos identifies a positions outside of text, the function returns the value -1. If off is greater than the length of text, an exception of the class CX_SY_RANGE_OUT_OF_BOUNDS is raised.


Note

The function char_off was suitable for finding the correct offsets of characters in non-Unicode double-byte systems.


Example

The result of the following function call is 7.

DATA(result) = char_off( val = `12345678` add = 4 off = 3 ).