LEFTB
从指定字符串的左侧字符开始提取子字符串,适用于使用双字节字符集 (DBCS) 的语言,如日语、中文、韩语等。
语法
expression.LEFTB(arg1, arg2);
expression - 表示 ApiWorksheetFunction 类的变量。
参数
| 名称 | 必需/可选 | 数据类型 | 默认值 | 描述 |
|---|---|---|---|---|
| arg1 | 必需 | ApiRange | ApiName | string | 包含要提取字符的文本字符串。 | |
| arg2 | 可选 | ApiRange | ApiName | number | 基于字节的子字符串字符数。 |
返回值
string
示例
此示例演示如何从指定字符串的左侧字符开始提取子字符串,适用于使用双字节字符集 (DBCS) 的语言,如日语、中文、韩语等。
// How to extract the substring from the left character.
// Use a function to get the substring from the left.
let worksheet = Api.GetActiveSheet();
let func = Api.WorksheetFunction;
worksheet.GetRange("A1").SetValue(func.LEFTB("Online Office", 6));