Remove trailing spaces from a string.
XSharp.Core (in XSharp.Core.dll) Version: 2.2a
Syntax View Source
cString AS STRING
) AS STRING
public static string Trim(
- Type: String
The string to trim.
<cString> with the trailing spaces removed. If <cString> is a NULL_STRING or all spaces, Trim() returns a NULL_STRING.
Trim() is used to format strings by deleting 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 Trim() to concatenate first and last name fields to form a name string.
Trim() is related to LTrim(), which removes leading spaces, and AllTrim(), which removes both leading and trailing spaces. The inverse of AllTrim(), LTrim(), and Trim() are the PadC(), PadR(), and PadL() functions, which center, right-justify, or left-justify strings by padding them with fill characters.
This is a function in which Trim() formats city, state, and zip code fields for labels or form letters:
FUNCTION CityState(cCity, cState, cZip)
RETURN Trim(cCity) + ", " ;
+ Trim(cState) + " " + cZip
To complete the example the function, CityState(), displays a record from CUSTOMER.DBF:
USE customer INDEX custname NEW
? CityState(City, State, ZipCode)
// Athens, GA 10066