diff --git a/DESCRIPTION b/DESCRIPTION index 3013c3f..53b6cb5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: xfun Type: Package Title: Supporting Functions for Packages Maintained by 'Yihui Xie' -Version: 0.46.4 +Version: 0.46.5 Authors@R: c( person("Yihui", "Xie", role = c("aut", "cre", "cph"), email = "xie@yihui.name", comment = c(ORCID = "0000-0003-0645-5666")), person("Wush", "Wu", role = "ctb"), diff --git a/R/utils.R b/R/utils.R index b1d6357..155bc82 100644 --- a/R/utils.R +++ b/R/utils.R @@ -356,3 +356,8 @@ handle_error = function( # a shorthand for rm(list =, envir =) rm_vars = function(x, envir, ...) rm(list = x, envir = envir, ...) + +# for R < 3.3.x +if (!exists('startsWith', baseenv(), inherits = TRUE)) startsWith = function(x, s) { + substring(x, 1, nchar(s)) == s +}