Firebird Documentation Index → Firebird 2.1 Language Ref. Update → External functions (UDFs) → rtrim |
Library: ib_udf
Changed in: 1.5, 1.5.2, 2.0
Better alternative: Internal function TRIM()
Description: Returns the input string with any trailing space characters removed. In new code, you are advised to use the internal function TRIM instead, as it is both more powerful and more versatile.
Result type: VARCHAR(n
)
Syntax (unchanged):
rtrim (str
)
Declaration:
DECLARE EXTERNAL FUNCTION rtrim CSTRING(255) NULL RETURNS CSTRING(255) FREE_IT ENTRY_POINT 'IB_UDF_rtrim' MODULE_NAME 'ib_udf'
The above declaration is from the file
ib_udf2.sql
. The NULL after the argument is an optional addition that became available in Firebird 2. If the argument is declared with the NULL keyword, the engine will pass aNULL
argument value unchanged to the function. This leads to aNULL
result, which is correct. Without the NULL keyword (your only option in pre-2.0 versions),NULL
is passed to the function as an empty string and the result is an empty string as well.For more information about passing
NULL
s to UDFs, see the note at the end of this book.
Notes:
Depending on how you declare it (see CSTRING note), this function can accept and return strings of up to 32767 characters.
Before Firebird 2.0, the result type was CHAR(n
).
In Firebird 1.5.1 and below, the default declaration used CSTRING(80) instead of CSTRING(255).
In Firebird 1.0.x, this function returned NULL
if the input string was either empty or NULL
.
Firebird Documentation Index → Firebird 2.1 Language Ref. Update → External functions (UDFs) → rtrim |