2013-04-11 01:07:29 -07:00
|
|
|
s <- "abcdefgh"
|
|
|
|
|
n <- 2; m <- 2; char <- 'd'; chars <- 'cd'
|
|
|
|
|
substring(s, n, n + m)
|
|
|
|
|
substring(s, n)
|
|
|
|
|
substring(s, 1, nchar(s)-1)
|
2018-06-22 20:57:24 +00:00
|
|
|
indx <- which(strsplit(s, '')[[1]] %in% strsplit(char, '')[[1]])
|
2013-04-11 01:07:29 -07:00
|
|
|
substring(s, indx, indx + m)
|
2018-06-22 20:57:24 +00:00
|
|
|
indx <- which(strsplit(s, '')[[1]] %in% strsplit(chars, '')[[1]])[1]
|
2013-04-11 01:07:29 -07:00
|
|
|
substring(s, indx, indx + m)
|