跳到主要内容

UNICODE

返回对应于文本第一个字符的数字(码位)。

语法

expression.UNICODE(arg1);

expression - 表示 ApiWorksheetFunction 类的变量。

参数

名称必需/可选数据类型默认值描述
arg1必需ApiRange | ApiName | string将返回其 Unicode 值的字符。

返回值

number

示例

在电子表格中返回与文本第一个字符对应的数字(码位)。

// The UNICODE function converts characters to their numeric Unicode values.

// Apply the function to obtain a character's code point from text in a spreadsheet.

let worksheet = Api.GetActiveSheet();
let func = Api.WorksheetFunction;
worksheet.GetRange("A1").SetValue(func.UNICODE("example"));