LSet 函数
更新:2007 年 11 月
返回包含已调整为指定长度的指定字符串的左对齐字符串。
Public Shared Function LSet( _
ByVal Source As String, _
ByVal Length As Integer _
) As String
参数
Source
必选。String 表达式。要调整的字符串变量。Length
必选。Integer 表达式。返回的字符串的长度。
备注
如果 Source 比 Length 长,则 LSet 仅返回最左侧的字符(最长为 Length 的长度)。如果 Source 比 Length 短,则 LSet 将向返回的字符串的右端添加空格,以便得到适当长度。
示例
本示例演示 LSet 函数的用法。
Dim TestString As String = "Left"
Dim lString As String
' Returns "Left "
lString = LSet(TestString, 10)
' Returns "Le"
lString = LSet(TestString, 2)
' Returns "Left"
lString = LSet(TestString, 4)
要求
**模块:**Strings
**程序集:**Visual Basic 运行库(在 Microsoft.VisualBasic.dll 中)