跳到主要内容

LEN

返回文本字符串中的字符数。

语法​

expression.LEN(arg1);

expression - 表示 ApiWorksheetFunction 类的变量。

参数​

名称必需/可选数据类型默认值描述
arg1必需ApiRange | ApiName | string将返回其长度的文本。空格被视为字符。

返回值​

number

示例​

计算电子表格中文本的字符数。

// How do I find out how many letters or characters are in a text string in a spreadsheet?

// Get the total character count of any text value in a spreadsheet.

let worksheet = Api.GetActiveSheet();
let func = Api.WorksheetFunction;
worksheet.GetRange("A1").SetValue(func.LEN("Online Office"));