在 R 编程中将 UTF8 值转换为整数 – utf8ToInt()函数
R 语言中的utf8ToInt()
函数用于将 UTF8 值转换为整数值。
Syntax: utf8ToInt(x, multiple)
Parameters:
x: Integer or integer vector
multiple: Boolean value to convert into single or multiple strings
示例 1:
# R program to convert a UTF8 to Integer
# Calling the utf8ToInt() function
utf8ToInt("[")
utf8ToInt("+")
utf8ToInt(":")
输出:
[1] 91
[1] 43
[1] 58
示例 2:
# R program to convert a UTF8 to Integer
# Creating a vector
x1 <- c("&@\n")
x2 <- c("[+:")
x3 <- c("1d")
# Calling the utf8ToInt() function
utf8ToInt(x1)
utf8ToInt(x2)
utf8ToInt(x3)
输出:
[1] 38 64 10
[1] 91 43 58
[1] 49 100 60 85 62