Firebird Documentation Index → Firebird 1.5 Language Ref. Update → External functions (UDFs) → substr |
Library: ib_udf
Changed in: 1.0, 1.5.2
Description: Returns a string's substring from startpos
to
endpos
, inclusively. Positions are 1-based. If
endpos
is past the end of the string, Firebird's
substr
returns all the characters from startpos
to the end of the string. InterBase's substr
returned
NULL
in this case.
Return type: CHAR(n
)
Syntax (unchanged):
substr (str
,startpos
,endpos
)
Declaration:
DECLARE EXTERNAL FUNCTION substr CSTRING(255), SMALLINT, SMALLINT RETURNS CSTRING(255) FREE_IT ENTRY_POINT 'IB_UDF_substr' MODULE_NAME 'ib_udf'
In Firebird 1.5.1 and below, the default declaration uses CSTRING(80) instead of CSTRING(255).
Depending on how you declare it (see CSTRING note), this function can accept and return strings of up to 32767 characters.
Although the function arguments are slightly different, consider using the internal SQL function SUBSTRING instead, for better compatibility.
Firebird Documentation Index → Firebird 1.5 Language Ref. Update → External functions (UDFs) → substr |