# (a) One string (with spaces and punctuation):
t1 <- "Hello world! This is _A TEST_. Does this work?"
(cv <- unlist(strsplit(t1, split = "")))
(t2 <- chars_to_text(cv))
t1 == t2
# (b) Multiple strings (nchar from 0 to >1):
s <- c("Hi", " ", "", "there!", " ", "", "Does THIS work?")
chars_to_text(s)
# Note: Using sep argument:
chars_to_text(c("Hi there!", "How are you today?"), sep = " ")
chars_to_text(1:3, sep = " | ")
Run the code above in your browser using DataLab