📅  最后修改于: 2022-03-11 14:58:23.686000             🧑  作者: Mango
fruit <- c("apple", "banana", "pear", "pinapple") # [1] TRUE
identical(str_detect(fruit, "a"), grepl("a",fruit)) # [1] TRUE
identical(str_detect(fruit, "^a"), grepl("^a",fruit)) # [1] TRUE
identical(str_detect(fruit, "a$"), grepl("a$",fruit)) # [1] TRUE
identical(str_detect(fruit, "b"), grepl("b",fruit)) # [1] TRUE
identical(str_detect(fruit, "[aeiou]"), grepl("[aeiou]",fruit)) # [1] TRUE