[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
RTRIM()
Remove trailing spaces from a character string
------------------------------------------------------------------------------
Syntax
RTRIM(<cString>) --> cTrimString
Arguments
<cString> is the character string to be copied without trailing
spaces.
Returns
RTRIM() returns a copy of <cString> with the trailing spaces removed.
If <cString> is a null string ("") or all spaces, RTRIM() returns a null
string ("").
Description
RTRIM() is a character function that formats character strings. It is
useful when you want to delete trailing spaces while concatenating
strings. This is typically the case with database fields which are
stored in fixed-width format. For example, you can use RTRIM() to
concatenate first and last name fields to form a name string.
RTRIM() is related to LTRIM() which removes leading spaces, and
ALLTRIM() which removes both leading and trailing spaces. The inverse
of ALLTRIM(), LTRIM(), and RTRIM() are the PADC(), PADR(), and PADL()
functions which center, right-justify, or left-justify character strings
by padding them with fill characters. RTRIM() is exactly the same as
TRIM() in function.
Notes
. Space characters: The RTRIM() function treats carriage
returns, line feeds, and tabs as space characters and removes these
as well.
Examples
. This is a user-defined function in which RTRIM() formats city,
state, and zip code fields for labels or form letters:
FUNCTION CityState(cCity, cState, cZip)
RETURN RTRIM(cCity) + ", " ;
+ RTRIM(cState) + " " + cZip
. In this example the user-defined function, CityState(),
displays a record from Customer.dbf:
USE Customer INDEX CustName NEW
SEEK "Kate"
? CityState(City, State, ZipCode)
// Result: Athens, GA 10066
Files Library is CLIPPER.LIB.
See Also:
PAD()
SUBSTR()
TRIM()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson