R 教材:字串 |
a <- paste("string", 9:1, ".txt", sep = "") nchar(a) strsplit(a, "\\.") substr(a, 1, 6) <- "Substr"; a match("Substr9.txt", a) |
a <- paste("string", 9:1, ".txt", sep = "") grep("([1,3,5-7])", a) b <- paste("string", 9:1, ".txt", sep = "", collapse = " ") gsub("([1,3,5-7]).(txt)", "_\\1-\\2", b) |
陳韋辰 (04/08/19) --- |