Firebird Documentation IndexFirebird 1.5 Language Ref. UpdateExternal functions (UDFs) → substrlen
Firebird Home Firebird Home Prev: substrFirebird Documentation IndexUp: External functions (UDFs)Next: truncate, i64truncate

substrlen

Library: ib_udf

Added in: 1.0

Changed in: 1.5.2

Better alternative: Internal function SUBSTRING()

Description: Returns the substring starting at startpos and having length characters (or less, if the end of the string is reached first). Positions are 1-based. If either startpos or length is smaller than 1, an empty string is returned.

Return type: CHAR(n)

Syntax: 

substrlen (str, startpos, length)

Declaration: 

DECLARE EXTERNAL FUNCTION substrlen
   CSTRING(255), SMALLINT, SMALLINT
   RETURNS CSTRING(255) FREE_IT
   ENTRY_POINT 'IB_UDF_substrlen' MODULE_NAME 'ib_udf'

Notes

  • 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.

Tip

Firebird 1.0 has also implemented the internal SQL function SUBSTRING, effectively rendering substrlen obsolete in the same version in which it was introduced. In new code, use SUBSTRING.

Prev: substrFirebird Documentation IndexUp: External functions (UDFs)Next: truncate, i64truncate
Firebird Documentation IndexFirebird 1.5 Language Ref. UpdateExternal functions (UDFs) → substrlen