R/hasUrlProtocol.R

###########################################################################/**
# @RdocDefault hasUrlProtocol
#
# @title "Checks if one or several pathnames has a URL protocol"
#
# \description{
#  @get "title".
# }
#
# @synopsis
#
# \arguments{
#   \item{pathname}{A @character @vector.}
#   \item{...}{Not used.}
# }
#
# \value{
#  Returns a @logical @vector.
# }
#
# @author
#
# @keyword IO
# @keyword programming
#*/###########################################################################
setMethodS3("hasUrlProtocol", "default", function(pathname, ...) {
  pattern <- "^([abcdefghijklmnopqrstuvwxyz]+)(://.*)"
  (regexpr(pattern, pathname) != -1)
})

Try the R.utils package in your browser

Any scripts or data that you put into this service are public.

R.utils documentation built on Nov. 18, 2023, 1:09 a.m.