fork(1) download
  1. x <- "ABCD"
  2. gsub("(.)(?=.)", "\\1,", x, perl=TRUE)
  3. # => [1] "A,B,C,D"
  4. gsub("(.)(?!$)", "\\1,", x, perl=TRUE)
  5. # => [1] "A,B,C,D"
  6. stringr::str_replace_all(x, "(.)(?!$)", "\\1,")
  7. # => [1] "A,B,C,D"
Success #stdin #stdout 0.28s 42840KB
stdin
Standard input is empty
stdout
[1] "A,B,C,D"
[1] "A,B,C,D"
[1] "A,B,C,D"