Click or drag to resize

AllTrim Function

X#
Remove leading and trailing spaces from a string.

Namespace:  XSharp.Core
Assembly:  XSharp.Core (in XSharp.Core.dll) Version: 2.21
Syntax
 FUNCTION AllTrim(
	cString AS STRING
) AS STRING
Request Example View Source

Parameters

cString
Type: String
The string to trim.

Return Value

Type: String
A trimmed string, with leading and trailing spaces removed.

Return Value

Type: String
A trimmed string, with leading and trailing spaces removed.
Remarks
AllTrim() is related to LTrim() and RTrim(), which remove leading and trailing spaces, respectively.
The inverse of AllTrim(), LTrim(), and RTrim() are the PadC(), PadL(), and PadR() functions, which center, left-justify, and right-justify strings by padding them with fill characters.
Examples
This example creates a string with both leading and trailing spaces, then trims them with AllTrim():
X#
1LOCAL cString AS STRING
2cString := SPACE(10) + "string" + SPACE(10)
3? SLen(cString)                            // 26
4? SLen(ALLTRIM(cString))                    // 6
See Also