📅  最后修改于: 2022-03-11 14:59:46.938000             🧑  作者: Mango
x <- "some text in a string"
substrRight <- function(x, n){
substr(x, nchar(x)-n+1, nchar(x))
}
substrRight(x, 6)
[1] "string"
substrRight(x, 8)
[1] "a string"