Open In App

Convert a UTF8 value to Integer in R Programming – utf8ToInt() Function

Last Updated : 16 Jun, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

utf8ToInt() function in R Language is used to convert a UTF8 value to an integer value.

Syntax: utf8ToInt(x, multiple)

Parameters:
x: Integer or integer vector
multiple: Boolean value to convert into single or multiple strings

Example 1:




# R program to convert a UTF8 to Integer
  
# Calling the utf8ToInt() function
utf8ToInt("[")
utf8ToInt("+")
utf8ToInt(":")


Output:

[1] 91
[1] 43
[1] 58

Example 2:




# R program to convert a UTF8 to Integer
  
# Creating a vector
x1 <- c("&@\n")
x2 <- c("[+:")
x3 <- c("1d<U>")
  
# Calling the utf8ToInt() function
utf8ToInt(x1)
utf8ToInt(x2)
utf8ToInt(x3)


Output:

[1] 38 64 10
[1] 91 43 58
[1]  49 100  60  85  62

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads