[R-gregmisc-commits] r2150 - pkg/gdata/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jun 5 21:23:11 CEST 2017


Author: warnes
Date: 2017-06-05 21:23:10 +0200 (Mon, 05 Jun 2017)
New Revision: 2150

Modified:
   pkg/gdata/R/startsWith.R
Log:
gdata::startsWith() now uses base::startsWith() to do the actual comparison, after hanlding ignore.case and trim arguments.

Modified: pkg/gdata/R/startsWith.R
===================================================================
--- pkg/gdata/R/startsWith.R	2017-06-05 19:22:07 UTC (rev 2149)
+++ pkg/gdata/R/startsWith.R	2017-06-05 19:23:10 UTC (rev 2150)
@@ -1,10 +1,14 @@
 startsWith <- function(str, pattern, trim=FALSE, ignore.case=FALSE)
   {
     if(trim) str <- trim(str)
+
     if(ignore.case)
       {
         str <- toupper(str)
         pattern <- toupper(pattern)
-      }
-    substr(str,start=1,stop=nchar(pattern))==pattern
+    }
+
+    #substr(str,start=1,stop=nchar(pattern))==pattern
+
+    base::startsWith(str, pattern)
   }



More information about the R-gregmisc-commits mailing list