点击或拖拽改变大小

Functions.AllTrim 方法

X#
从字符串中删除前导和尾随空格。

命名空间:  XSharp.VFP
程序集:  XSharp.VFP (在 XSharp.VFP.dll 中) 版本:2.22 GA
语法
 FUNCTION AllTrim(
	Expression AS STRING,
	Flags AS LONG,
	TrimChars PARAMS STRING[]
) AS STRING
查看代码

参数

Expression
类型:String
Specifies an expression to remove leading and trailing spaces or 0 bytes from
Flags
类型:Int32
Specifies if trimming is case-sensitive when one or more parse characters (cParseChar, cParseChar2, … are included. Trimming is case-sensitive if nFlags is zero or is omitted. Trimming is case-insensitive if nFlags = 1.
TrimChars
类型:String
Specifies one or more character strings that are trimmed from the beginning of cExpression. If cParseChar isn't included, then leading spaces or 0 bytes are removed from Expression.

返回值

类型:String
修剪后的字符串,已删除前导和尾随空格。
备注
AllTrim() 与 LTrim() 和 RTrim() 相关,它们分别删除前导和尾随空格。
AllTrim()、LTrim() 和 RTrim() 的反向操作是 PadC()、PadL() 和 PadR() 函数,它们通过用填充字符填充字符串来使其居中、左对齐和右对齐。
示例
此示例创建一个带有前导和尾随空格的字符串,然后使用 AllTrim() 修剪它们:
X#
1LOCAL cString AS STRING
2cString := SPACE(10) + "string" + SPACE(10)
3? SLen(cString)                            // 26
4? SLen(ALLTRIM(cString))                    // 6
参见