当前位置: 首页 > 图文教程 > 脚本技术 > VBScript > VBS教程:函数-Left 函数

VBScript
VBS教程:方法-GetDrive 方法
VBS教程:方法-GetBaseName 方法
VBS教程:方法-GetAbsolutePathName 方法
VBS教程:方法-FolderExists 方法
VBS教程:方法-FileExists 方法
VBS教程:方法-Exists 方法
VBS教程:方法-DriveExists 方法
VBS教程:方法-DeleteFolder 方法
VBS教程:方法-DeleteFile 方法
VBS教程:方法-Delete 方法
VBS教程:方法-CreateTextFile 方法
VBS教程:方法-CreateFolder 方法
VBS教程:方法-CopyFolder 方法
VBS教程:方法-CopyFile 方法
VBS教程:方法-Copy 方法
VBS教程:方法-Close 方法
VBS教程:方法-BuildPath 方法
VBS教程:方法-AddFolders 方法(Folders)
VBS教程:方法-Add 方法(Dictionary)
VBS教程:VBScript 语句-With 语句

VBScript 中的 VBS教程:函数-Left 函数


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-11   浏览: 105 ::
收藏到网摘: n/a

Left 函数

返回指定数目的从字符串的左边算起的字符。

Left(string, length)

参数

string

字符串表达式,其最左边的字符被返回。如果 string 参数中包含 Null,则返回 Null

Length

数值表达式,指明要返回的字符数目。如果是 0,返回零长度字符串 ("");如果大于或等于 string 参数中的字符总数,则返回整个字符串。

说明

可使用 Len 函数确定 string 参数中的字符数目。

下面的示例利用Left 函数返回MyString 的左边三个字母:

Dim MyString, LeftStringMyString = "VBSCript"LeftString = Left(MyString, 3) 'LeftString 包含 "VBS"

注意 LeftB 函数与包含在字符串中字节数据一起使用。length 不是指定返回的字符串数,而是字节数。