Skip to content
Related Articles

Related Articles

Convert a UTF8 value to Integer in R Programming – utf8ToInt() Function
  • Last Updated : 16 Jun, 2020

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:

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output:

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

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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)

chevron_right


Output:

[1] 38 64 10
[1] 91 43 58
[1]  49 100  60  85  62
My Personal Notes arrow_drop_up
Recommended Articles
Page :