Skip to content

Commit

Permalink
add unexported char_to_hex() and char_to_unicode() utility functions
Browse files Browse the repository at this point in the history
  • Loading branch information
cjyetman committed Jan 13, 2024
1 parent b0997c0 commit 678a9f4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions R/char_to_.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
char_to_hex <- function(x) {
cat(paste(paste0("\\x", charToRaw(x)), collapse = ""))
}

char_to_unicode <- function(x) {
cat(paste0("\\U", format(as.hexmode(utf8ToInt(x)), width = 2 * length(charToRaw(x)), upper = TRUE)))
}

0 comments on commit 678a9f4

Please sign in to comment.